What is the correct way to override a template from a custom module?

I found a paragraph in the documentation about using template files in a custom module. This way can be even used to override a template like I did here.

However, I am wondering if this is the correct way since I have read this answer (which seems does not work with dynamically-generated suggestion).

After some research I noticed that we can see sometimes the use of:

  • hook_theme_registry_alter
  • hook_theme alone
  • hook_theme with hook_theme_suggestions_HOOK_alter

Apparently there is no clear documentation about that.

Is there a difference between adding a template and overriding a template, from a custom module? If so, what’s the correct way to add a template and the correct way to override a template?