This is a variation on Willeke's answer, in that you're not specifically filtering or sorting by proximity to the line, but using the map to do so visually:
- Go to Google Maps
- Search for your destination
- Click on "Hotels" (or type hotels in the search box)
- If public transit lines are not already shown (depends on your Google Maps preferences), hover the "Layers" box (currently bottom left of the map) and click on "Transit".
Now you have both hotels and transit lines (those known to Google maps at least, but at least all London Underground, Overground and the Elizabeth Line are shown) on the same map.
You can zoom and pan around, and you can apply the usual filters on hotels.
Note however that you will have to zoom in quite a bit before you can see the actual stations rather than just the lines (and be aware that they do not all show up at the same zoom level).
If you're looking for convenient hotels outside of central London (to reduce costs), note that of course your choice is probably a combination of distance to a station, distance of that station to wherever you intend to go (which affects both time and cost), frequency (for lines which split you probably want to avoid being on a branch with less trains), etc. Remember that it can take over an hour to get from some tube stations to central London, and that tube fares can be pricey.
Also be aware that outside of central London, geographical (as the crow flies) proximity to a tube station does not necessarily mean easy access.
In the case of wanting access to places outside central London (as in the case of Heathrow in your example), then one also needs to pay attention to which branch of the line one considers. Being on the Reading branch of the Elizabeth Line or the Uxbridge branch of the Piccadilly Line will require you to change.
On the Elizabeth Line, this extends to the western branches: services to Heathrow all originate on the Abbey Wood branch, if you are on the Shenfield branch you will have to change trains (though in this case this is extremely easy, one just needs to get off the train in one of the stations in the central section and wait for a train to the right destination on the same platform).