Windsor Castle is very close to Heathrow. But the public transport will take about an hour there and the same back (enough time for a 2hr visit for you).
20-30 minutes by Uber.
Central London is further away but somewhat better connected so can also be reached in about an hour by public transport. (Much more expensive by Taxi)