I will be at Heathrow at 11 pm, coming from Glasgow, after an incredible rush lasting for two days. I have next plane to Zagreb, Croatia, next morning at 8,30. It would be nice to have a proper sleep for a few hours at the airport instead of sitting in the terminal for more than 10 hours after such a mess. What is the easiest and the cheapest mode to provide a decent place to sleep without leaving the airport?
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
After your flight from Glasgow you will not be able to go airside for your onward flight the next day, even if you wanted. You will arrive in the domestic arrivals area and then exit into the public part of the airport. In principle you can remain here overnight if you wish but it is made deliberately uncomfortable to discourage this.
The only hotel you can access without leaving the terminal 5 area is also one of the most expensive (the Sofitel). However it is very easy and reasonably pleasant to stay in: I would be disappointed not to be in bed within 30 minutes of landing with this hotel. It sometimes comes up on anonymous hotel searches like Priceline as the only five star hotel in the area at a sizeable discount.
There is I think a Yotel in the central terminal area. You can get to this area for free on the local public transport.
There are about 50 other hotels in the surrounding area of variable quality, price and distance. Almost all are beyond walking distance. The hotel "Hoppa" shuttle bus is not free (£5 each way) but if you stay on Bath Road or within the London transport area you can use the free local red buses instead. (London buses are free in the immediate vicinity of Heathrow.) You may wish to factor that in if price is a concern to you.