If you want to lose weight and build muscle, it is best to do strength training before cardio. The reason is that usually what you do first is what you do best, and also you have more energy at the start of your workout.
Strength training requires all of your energy to perform at your maximum and at your best. Cardio is a way to burn some extra calories and to improve your stamina. It’s ok to do this second as you will probably burn the same amount of calories whether you do it first of last.
Another way to look at it is before you start your workout, your body is full of “easily” accessible energy. If you do your cardio first, then you are burning off all the easy to access energy. Take an example of using 200 calories. Those 200 easy to access calories would have made your strength training way more effective. You would have more energy stored in your body but most of it isn’t available as quickly as you need for lifting weights, especially short burst of energy for lifting and strength training. However, it is ok for cardio workout to tap into the additional energy in a continuous manner, particularly for burning some extra calories.
So, to optimise your workout, lose weight and build muscle, you should do strength training before cardio.