I've been having this for a while on my server. I tried this same world in singleplayer and the glitch was gone, but when I took the same world and put it back on the server, the glitch happened again.
How to reproduce
1. Be on a server.
2. Place a bed anywhere above and including 128.
3. Sleep in your bed at night.
4. If you open up the F3 menu, you will notice you are under 0 y, but finishing your sleep or exiting the bed will bring you back normally.
Duplicate of MC-3599 - If you have not, please use the search function in the future, to see if your bug has already been submitted. If you could not find the original report, please comment with the keywords you searched for.