The standard sequence in both حج and عمرہ is طواف first, then سعی. For عمرہ, all four schools agree that سعی must follow طواف — this sequence is an integral part of the ritual. Performing سعی before طواف in عمرہ would mean you need to redo the سعی after completing طواف.
For حج, there is more scholarly discussion. The Hanbali school allows some flexibility: if a حاجی has already performed طواف al-Qudum (the arrival طواف), they may perform سعی after it. They may also, according to some Hanbali scholars, perform the سعی of حج on the Day of عرفات before performing طواف al-Ifadah. This is based on the hadith where نبی کریم (صلی اللہ علیہ وسلم) was asked on the Day of Sacrifice about performing rituals out of order and said: 'Do it, and there is no harm.'
The Hanafi, Maliki, and Shafi'i schools maintain that سعی must always follow a preceding طواف, whether it is طواف al-Qudum or طواف al-Ifadah. If someone performs سعی without a preceding طواف, it is not counted and must be repeated. For practical purposes, following the standard sequence (طواف then سعی) is the safest approach accepted by all schools. If you find yourself in an unusual situation, consult a knowledgeable scholar present at the Haram.