Defining functions in a module and calling them from a controller
This is exactly the case when you define a Service: 


In your controller you call the service with Dependency injection
In your module you call the static \Drupal::service('..')