How to hide a specific user profile?
To avoid users can access a user profile, I would implement hook_ENTITY_TYPE_access().
For the search engines, it would be sufficient to check the logged-in user isn't anonymous. For any Drupal user and the search engines, it's sufficient to check the permission the logged-in user has. (I would not hide the user profile to users who have the permission to administer users.)

In the first case, I would use code similar to the following one. 

function mymodule_user_access(EntityInterface $entity, $operation, AccountInterface $account) {
  if ($operation == 'view' &amp;&amp; $entity-&gt;id() == USER_ID &amp;&amp; $account-&gt;isAnonymous()) {
    return AccessResult::forbidden()-&gt;cachePerUser();
  }
}


In the second case, I would use code similar to the following one.

function mymodule_user_access(EntityInterface $entity, $operation, AccountInterface $account) {
  if ($operation == 'view' &amp;&amp; $entity-&gt;id() == USER_ID &amp;&amp; !$account-&gt;hasPermission('administer users')) {
    return AccessResult::forbidden()-&gt;cachePerPermissions();
  }
}


(In both the cases, replace USER_ID with the actual user ID of the user profile you need to hide.)

The code checks the value of the operation, and forbids it only when it's view. In this way, the code is simpler, as it doesn't need to check users are trying to edit their own accounts, for example (which I assume it's not an operation you want to forbid).

hook_ENTITY_TYPE_access() is not invoked for pages listing more than one entity, for example a view page. In the case of user accounts, hook_ENTITY_TYPE_access() should be sufficient, but if you want to avoid that user account is listed also in a view output, the alternative is hook_query_TAG_alter() which is more complicated to implement, but it works in every case.