Shader node to get z value
Personally, I would create a 'Sea Level' object and extract the Z of its Object Space like this:



Now the Z output is a number; the height above/below sea level in Blender units. You can scale that number, map it to another range, put it through curves or a color ramp.. whatever you need. If you put this pair of nodes into a little group, you can quickly include it in any material