In multiple-electron systems these are split into different energy levels, in that case the lower values are usually lower in energy level (i.e. S becomes lower than P)
The energy levels of multi-electron atoms are mostly found by spectroscopy. Understanding why the levels are arranged that way can be solved by computers using wave equations, but "a computer confirmed it" isn't a fun answer. A less reliable answer, but one more relatable to humans, can be found by considering orbital penetration.
Consider the radial distribution functions shown below, these show for each orbital how the probability of finding an electron varies with distances from the nucleus.
You can view more at the orbitron, but you should be able to see a pattern in these. Going up in principle quantum numbers, the first S has one hump, the second S has two humps, and so on. The other subshells follow the same pattern.
For an atom containing 2S and 2P electrons, such as carbon, we know from A-level chemistry that the S orbitals are filled first. The reason is electron shielding, electrons close to the nucleus reduce the attraction of electrons outside the nucleus, since negative charge repels. 2S electrons experience relatively less shielding then 2P electrons because they have an extra hump close to the nucleus, and you can see it by superimposing their radial distribution functions:
|Superimposition of the 2S and 2P subshells|
The penetration of the 2S subshell allows electrons in it to experience more nuclear charge, which is enough to dip the orbital lower in energy level. I'm aware that it isn't entirely obvious from the above graph, but this answer is enough for many undergrad exams and textbooks.
Note: The S subshell has the unique property of having a non-zero chance of being found on the nucleus itself. This means you should draw the functions touching the Y-axis at just above 0, with other orbitals hitting it right on 0. It is common for some exam marks to based on this.