Localhost vs IP address

I don’t know the exact technical reason, but for localhost I generally use 127.0.0.1, only when trying to connect from inside the network but from a different device I use the 192 address.