Hi!
In my experience, you can use Sharepoint permissions levels to complete it. If you are the admin in Teams, go to SharePoint online admin center and set it like the following picture:
For more details about settings, you can also learn it from:
https://techcommunity.microsoft.com/t5/healthcare-and-life-sciences/setting-individual-file-permissions-for-documents-used-in/ba-p/840939