In order to make efficient WordPress themes and to help in maintaining a clean code structure, knowing the priority WordPress gives to a custom page in the loading sequence is essential to achieve this task.
Here’s the WordPress Template Hierarchy Schema to help visualize the loading sequence. This schema is best read from left to right meaning the left most template will override any template to it’s right. More can be found in the Theme Handbook of the WordPress developers website.
I wrote a piece on overriding the WordPress template hierarchy. So if you are looking to override the template hierarchy, you can check that post.