How to Check Logged in User has a Custom Permission in Salesforce
checkPermission(apiName) – Checks whether a custom permission is enabled.
Boolean hasPermission = FeatureManagement.checkPermission('CustomPermissionAPIName');
Note. You can also use the FeatureManagement.checkPermission method to check if the user has been assigned a custom permission without SOQL