well without asking you to share the full code you’re using (obviously you don’t need to share your OU), I would first confirm that the OU you’re specifying does actually exist. Load the ActiveDirectory module and do:
Get-ADOrganizationalUnit 'OU=Name,DC=domain,DC=com'
If it returns the OU you are trying to specify, then it does exist, and I’d then say perhaps there may be some missing link between O365 and your AD domain somehow. I do not have any experience with O365 at all unfortunately but hopefully this will at least get you on track to troubleshooting your issue.
If you know the name of one of the user accounts you’re looking at as well you could do:
Get-ADUser -Identity username | Select-Object -ExpandProperty distinguishedname
This will get you the full distinguished name of the full distinguished name of the user, then you can just remove the ‘CN=’ part of the dn to then have the OU that the user is in.