Purchase or avail a trial version of Azure AD Premium P2 and configure block access for the user.
The example below is the steps for blocking access of users from SharePoint\OneDrive services for specific condition.
Go to portal.azure.com and sign-in your Office 365 admin account
Select the Azure Active Directory > go to “Conditional Access” > Avail the Premium Trial then you’ll be able to create a policy (you don’t have to assign the license)
Create a policy disabling SharePoint and Microsoft Teams and other apps for one user
Should you have one, click here