I always made this mistake. I always used to start my workouts at the gym by getting on a stationary bike first for at least 20 minutes to really pedal myself warm, my goal was always to hit 170bpm within that 20 minutes and really break out into a good sweat. Then I would proceed to do weight training.
Turns out—I was wrong. (And funny enough, it was the personal trainer whom I had initially hired at the gym who advised me to do that. Just goes to show that you want to be very selective about who you choose as a personal trainer.)
In this video Jeff Cavaliere from Athlean X breaks it down:
If you still want to keep doing cardio, then do it AFTER you did the strength training, not before.