A workout should ideally follow a relatively strict ordering.
- High-skill/coordination exercises or movements which you are still learning, e.g. agility drills, Olympic lifts, gymnastics
- Speed drills or explosive efforts, e.g. sprints, throws, Olympic lifts, power variants of the Olympic lifts
- Strength exercises, e.g. squats, deadlifts, presses, pull-ups
- Endurance exercises and longer-duration efforts, e.g. jogging, bodyweight squats and other calisthenics
This optimizes recovery, learning of motor patterns, and speed and strength development. It can also be dangerous to do highly-loaded strength exercises or high-skill movements while fatigued. (Much of this is taken from Science of Sports Training, Thomas Kurz, from several parts but leaning heavily on a summary on page 14.)
So for example, Olympic lifters often put their squats last. They know that squats are a tremendously important exercise that they value highly, but they also have a lot of technique work to do, which requires a lot of coordination and fresh focus.
For another example, a wrestler should ideally learn new movements soon or immediately after warming up, then do drills, then wrestle, and finally hit the weight room for a few lifts. This way they are at their best physical readiness to learn a new skill, and then transition into skilled movements that they already know well. Wrestling after that requires coordination but also some strength and endurance. Their lifting goes last so it does not interfere with the more important and more skilled wrestling movements.
In general, when deciding a tie between exercises, the higher-priority movement goes first. So, if both barbell squats and overhead press are equally well-trained, there is little difference between them. Then the choice is simply which one you want to progress more with.
But optimization is not always the goal. If you feel better jogging for half an hour before squatting, don't let guidelines hold you back. Don't let the perfect be the enemy of the good.
For instance, to continue the earlier squat/press example, the deadlift is generally put after both because it is so draining. But if you don't particularly care about your squat, and you find squats more draining than most, then it might make sense to put them closer to the end so that you can put more fresh energy into the bench press and pull-ups (or whatever).