How to register a new PHP function in Twig?
In the docs it says:


  Functions
  
  To register a new filter you should implement hook_twig_function() and
  return an indexed array with unique keys and new Twig_SimpleFunction
  as value.

function my_module_twig_function(){



To answer your question:


  My simple question is: where should I implement my functions? 


Notice how it uses "my_module", so clearly in your custom module .module file is where these function(s) should be added. If you don't have a custom module yet, then you will need to create one.

So if your custom module is named Hello Kitty, then in hello_kitty.module

function hello_kitty_twig_function(){
    $functions = [];
    $functions['coolfunction'] = new Twig_SimpleFunction('coolfunction','hello_kitty_coolfunction');
    return $filters;
}

function hello_kitty_coolfunction($param_1,$param_2...){
    // do what you need to do, and return something.
}