Please check following settings to enable anyone link in the SharePoint.
1.Enable external sharing in the tenant level. Go to SharePoint admin center -> Polices -> Sharing -> Set Anyone in the Content can be shared with section.
2.Enable external sharing in the tenant site level. Go to SharePoint admin center -> Sites -> Active sites -> Select the site -> Sharing -> Set Anyone in the External sharing.
3.In the site collection -> Site settings -> Site collection features -> Deactivate Limited-access user permission lockdown mode.
4.Browse to the site and edit the URL by adding the following string to the end of it: /_layouts/15/people.aspx?MembershipGroupId=0 -> Select the person from the list, and then on the Actions menu, select Delete Users from Site Collection.
5.Share the site or folder with the external user through anyone link.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.