The user account interface provides a method for checking whether a user entity has a permission. To check whether the current user has a permission, you will get the current user, and you need to invoke the hasPermission method:
\Drupal::currentUser()->hasPermission('my permission');
The \Drupal::currentUser() method returns the current active user object. This allows you to check whether the active user has the necessary permissions to perform certain types of actions.