The contest we are talking about (trying to hide while the enemy tries not to lose track of you) is not "first: hide, then: search."
This contest is simultaneous. It literally doesn't matter which die is thrown first at the table around which the players are sitting, because what is being represented is the simultaneous opposing efforts.
In a tug-of-war you don't have the two teams taking turns to pull the rope! Both teams are pulling at the same time, and if you are playing this out in 5E rules then it doesn't matter which d20 hits the table first, the action in-game is simultaneous and opposing.
In the contest of Stealth versus Perception where the guy trying to become hidden is being actively opposed throughout the entire process by the enemy trying not to lose track of him, then either the Stealth check OR the Perception check could be rolled first at the gaming table, but it makes no difference to the in-world situation of simultaneous struggle.
One player rolls the d20 for one skill check, another rolls the d20 for the other check (or the DM might roll), and the two results are compared. It makes no difference who rolled first at the table because the actions being resolved are simultaneous.