Defining functions in a module and calling them from a controller I want to use a function in both a controller and a module. where should I define that function?

Can I call a function in module from a controller? How I can do that?
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('..')