Please check below tips to troubleshoot the issue.
1.Enable external sharing in the tenant level. Go to SharePoint admin center -> Polices -> Sharing -> Set Anyone, New and existing guests or Existing guests only for both SharePoint and OneDrive.
2.Enable external sharing in the tenant site level. Go to SharePoint admin center -> Sites -> Active sites -> Select the site -> Sharing -> Set Anyone, New and existing guests or Existing guests only.
3.Go the site collection which documents stored in -> Site settings -> Site collection features -> Deactivate Limited-access user permission lockdown mode feature.
4.When you share a document, select the file -> Share -> Settings gear icon -> Check the link type. It should be chosen Anyone, People with existing access or People you choose.
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.