Sharing files and folders with external users in any organisation is unavoidable and a must in many cases.
Managing external access with Microsoft 365 is something that Administrators need to pay attention to and have a strategy to mitigate the risks that comes with it.
To expire access to M365 SharePoint and OneDrive files and folder, Open the SharePoint Admin Center and Click on Sharing (located under Policies)
In the External Sharing page, expand the More external sharing settings menu.
As shown below, Tick the box next to Guest access to site or OneDrive will expire automatically after this many days.
The default option is 60 days; however, it might be too little for some companies.