how depth is measured
A world is cut into five layers, and each behaves differently enough that knowing which one you are standing in changes what you should be doing. You read your position with a Depth Meter or anything that includes one, such as the GPS, the PDA or the Cell Phone. On desktop, console and mobile the readout is in feet at two feet to the tile. Old-gen console reports meters instead, at half a meter to the tile. The 3DS version has no depth readout at all.
The numbers count upward from Level Surface and then downward from it, and every reading carries the layer name with it, so you never actually have to memorize a figure. That is just as well, because the boundaries move. They depend on world size and on the generation of that particular world, so a depth that puts you in the Cavern in one save is still Underground in another.
space and surface
Space is the top. Gravity is reduced, the sky is black at every hour of the day, and nothing generates there except the parts of Floating Islands and Living Trees that reach into it. Harpies live there, with Wyverns joining them in hardmode.
The surface holds most of the biomes you know by name, along with the dungeon entrance and any meteorite that lands. Two rules make this layer unlike the others. Grass only grows and spreads naturally up here, and that applies to regular, corrupt, crimson and hallowed grass alike. You can plant grass lower down with seeds or a Staff of Regrowth, but it will sit where you put it and never spread, which is why an artificial underground jungle has to be laid out tile by tile. Trees and the thorny bushes an evil biome grows are also surface only.
The second rule catches people out. Anything above zero feet is still surface even if it is buried and you had to dig to reach it. Carve a room into a hillside and it is a surface room, with surface fishing and surface spawns, no matter how much rock is over your head.
underground and cavern
The Underground layer runs from zero feet down to the top of the Cavern and carries the same biome list as the surface above it. Its backdrop shows dirt with stones set into it.
The Cavern is the largest layer in the world and the one holding most of what you go down for. The true forms of the underground biomes are here: the Ice biome, the Underground Jungle, the Underground Desert and the underground glowing mushroom biomes, with generic cave filling the gaps between them, plus Underground Corruption, Crimson and Hallow once hardmode arrives. Most of the dungeon's length runs through this layer as well. Its backdrop is the same picture as the Underground with the dirt shaded darker until it reads as stone.
It helps to split the Cavern in half mentally. The Ice biome stops at the bottom of the upper Cavern, and lava pools are essentially a lower Cavern feature, so the depth at which you start meeting open lava is a decent marker for which half you are in.
underworld
The bottom three hundred or so feet are the Underworld, which is a biome in its own right rather than a container for others. Nothing else generates inside it. Lava is everywhere and the background is open air with magma pillars behind it. Any water that reaches this layer evaporates almost at once, which is the basis of the standard drainage trick: open a shaft from a flooded cave or an ocean down to the Underworld and let gravity empty it for you.

