This is config and you can get it with the following snippet.
$admin_theme = \Drupal::config('system.theme')->get('admin');
$admin_theme_name = \Drupal::service('theme_handler')->getName($admin_theme);
Or with Drush:
drush cget system.theme admin
You shouldn't do queries like like that. You should use EntityQuery. See https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21Query%21QueryInterface.php/function/QueryInterface%3A%3Acondition/8.8.x and EntityFieldQuery to search Content Type for text and select matching Nodes
EntityQuery will return the nids. Then use the node storage's ...
To print user fields on the page template create a Views block and place it in an existing region.
At best you first added a new view mode for User under https://example.com/admin/structure/display-modes/view and then on https://example.com/admin/config/people/accounts/display select the newly created view mode and place the fields you like to display.
This can be done in two ways:
1) Use the Field group module.
Field Group has added the ability to move items to the right sidebar on the node edit form.
2) Write a hook_form_alter() in a custom module.
If you have more complicated needs than what Field Group provides you can do this in custom code.
* Implements hook_form_alter().