Maybe to expand my comment, here general relevant rules regarding prayer:
1) Every prayer must be prayed in its assigned time slot.
2) There are three times when praying is haram: shortly before sunrise until the sun has risen properly, after the moment when the sun is in its zenith until it has properly passed the zenith, and from the time when the sun is close to going down (which starts when the sun is a small bit above the horizon) until the sun has completely vanished. Two notes: the dhuhr prayer cannot be offered in the second of those three times, and the fajr and asr prayer can be prayed in the first and third of the mentioned times, but it is haram to leave either one until that point. These rules are from recollection, if I am wrong, someone correct me please.
3) Making up missed prayers takes precedent over other obligations, apart from praying the currently obligatory prayer, unless there is enough time to make up the missed prayer before praying the current prayer in its own time slot (saving a life you are obliged to save could be an exception too, I'm not sure). So, if you have a prayer to make up, and you have not yet prayed the current prayer, there are two cases: a) you have enough time left to make up the missed prayer before the current one and then still pray the current prayer in its time -> make up the missed one first b) you do not have enough time left in the current slot to pray both -> pray the current one first. This is mentioned in section f2.9 in "reliance of the traveler", the most authoritative shafii manual of fiqh. It also says there that if you find while making up the missed prayer that if you complete it, you will miss the time for the current one (i.e. you misjudged how much time you would need and would finish too late), then interrupt the makeup prayer and start the current one instead.
4) Whether your prayer was on time depends on a criterion that is debated, I think (someone correct me if I'm wrong, i.e. in case there is consensus here): some say it suffices to say the first "allahu akbar" on time, some say the first ruku (bowing while standing) must be finished on time, some say the first sujud (prostration), some say the first raka, some say the whole prayer. I seem to recall I have seen all of those opinions, and in "reliance of the traveler" it is mentioned in section f2.3 that the cutoff is one raka, meaning for the prayer to be considered to be prayed in its time, you must complete the first raka before the time for the prayer ends. A raka counts as finished once you lift your head from the second sujud. It also says it is forbidden to wait with prayer until a point where the first raka can still be completed on time, but part of the prayer will be offered after the prayer's time slot.