Even though the buses are no longer free, they are frequent (though less frequent from T5 than from T2/3) and very convenient for the hotels along Bath Road, so you are not limited to hotels within the airport. I believe the bus fare is now £1.65, and you will definitely need a contactless card as no cash is accepted.
To avoid confusion and delay at Heathrow, find out in advance which bus bay your bus will leave from at
Keeping London moving - Transport for London (tfl.gov.uk).