Hi @john john ,
I believe there is no way to get that list of all the users who can access the site. SharePoint doesn't even know it.
SiteUsers is the closest, it includes users who have a relationship with the site (have access or used to have access to this site/item, or assigned with an item .etc). Once it establishes the relationship, it will be resolved as a user entity in the collection.
In the past, it doesn't include users who have access due to group membership but haven't used that access yet. From SP2013, It has been changed a little bit, SiteUsers will contain the user as soon as you give them permission to site regardless of they logon this site or not.
Best Regards,
Baker Kong
If an Answer is helpful, please click "Accept Answer" and upvote it.
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.