sharing code in custom module
If you want the class declared in my_module/src/Utils.php to be made available to any PHP script, add this at the top of that script file:

use Drupal\my_module\Utils;


This of course assumes that you're following the correct PSR-4 standards for naming: make sure that mymodule/src/Utils.php exists, and contains one single class named Utils, with namespace Drupal\my_module at the top.

See PSR-4 namespaces and autoloading in Drupal 8 for a more in-depth explanation.