Based on my research, there are two options for limiting who users can see when they search the directory in Teams:
If using either option, you must turn on search by name in the Teams admin center, select Teams > Teams Setting > Search Ny Name > Scope directory search using an Exchange address book policy.
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.