How to query all the Visualforce Pages the profile have access to in Salesforce?

1. Run the below SOQL to get the PermissionSet Id.
SELECT Id, Profile.Name FROM PermissionSet WHERE Profile.Name = 'System Administrator'

2. Use the PermissionSet Id from the step 1 and use it in the below SOQL for ParentId.
SELECT Name FROM ApexPage WHERE Id IN ( SELECT SetupEntityId FROM SetupEntityAccess WHERE ParentId = '0PS4x000003oZ9DGAU' AND SetupEntityType = 'ApexPage' )