How can I power mobile devices from my 36v or 48v battery safely?
There are many cheap and powerful  DC-DC converters on the market. You need step-down configuration. Try searching "buck converter".

However, be aware that some of them (especially cheap ones) may be really noisy. This noise may affect badly on electronics. Kinda cheap and dirty solution is to set up a voltage around 6-7V and then use voltage regulator with high PSRR to get clean 5V.

Also, if you are considering 48v getting into 5v, you may put a thermal fuse on regulator. In case of 48v regulator will get most of voltage and fuse will break.