how to pull all usernames from a custom user role, then do some array modification

just swap TYPE1USERNAMEHERE for your username(s) which is hidden from everyone and will also beable to see everyone
and swap TYPE1ROLETOHIDEHERE for your role(s) you want to hide from others except the above username(s)

/* EDIT USERNAMES AND ROLES - Hide users from others -  DISABLE THEME CHANGE ON AAM FOR ALL OTHER ROLES... or else they can just change functions.php lol
*/
add_action('pre_user_query','yoursite_pre_user_query');
function yoursite_pre_user_query($user_search) {
  global $current_user;
  $username = $current_user->user_login;

 //BOTH statements MUST be true to proceed, if one fails the if statement is cancelled
 $hiddenlist = array('\'TYPE1USERNAMEHERE\'' , '\'TYPE2USERNAMEHERE\'');
 $roles = array('TYPE1ROLETOHIDEHERE , TYPE2ROLETOHIDEHERE');
 //THESE USERS ARENT AFFECTED BY THIS FUNCTION AND CAN SEE EVERYTHING
  if (($username != 'TYPE1USERNAMEHERE') && ($username != 'TYPE2USERNAMEHERE'))
  { 
    //start of test
//this sucessfully gets all user IDs of many roles
    global $wpdb;
    if ( ! is_array( $roles ) )
        $roles = array_walk( explode( ",", $roles ), 'trim' );
    $sql="
        SELECT  ID, display_name
        FROM        " . $wpdb->users . ' INNER JOIN ' . $wpdb->usermeta . '
        ON          ' . $wpdb->users . '.ID             =       ' . $wpdb->usermeta . '.user_id
        WHERE       ' . $wpdb->usermeta . '.meta_key        =       \'' . $wpdb->prefix . 'capabilities\'
        AND     (
    ';
    $i = 1;
    foreach ( $roles as $role ) {
        $sql .= ' ' . $wpdb->usermeta . '.meta_value    LIKE    \'%"' . $role . '"%\' ';
        if ( $i < count( $roles ) ) $sql .= ' OR ';
        $i++;
    }
    $sql .= ' ) ';
    $sql .= ' ORDER BY display_name ';
    $userIDs = $wpdb->get_col( $sql );
    //now $userIDs is an array of all user ID of the matched role

    //hide these users with matching IDs
    foreach ($userIDs as $comparedID) {
    global $wpdb;
    $user_search->query_where = str_replace('WHERE 1=1',
      "WHERE 1=1 AND {$wpdb->users}.ID<>" . $comparedID ,$user_search->query_where);
    } 
    //hide these users with matching usernames
    foreach ($hiddenlist as $comparedname) {
    global $wpdb;
    $user_search->query_where = str_replace('WHERE 1=1',
     "WHERE 1=1 AND {$wpdb->users}.user_login != " . $comparedname ,$user_search->query_where);
    }
   
  }
}