"We plan to go in late July early August."
My most recent (2024) visit to Istanbul was 8 nights in August - timed to attend a family wedding. I realized quickly that I needed to plan my time to avoid the mid day heat.
I broke up some days into morning and evening sightseeing, with an indoor break during the hottest mid day hours. That could be in my room, in a mosque, a Bazaar, a museum, or in a restaurant.
If you're planning to visit Basilica Cistern, that will also be cooler than the Istanbul streets in the middle of August.
Another great option during the heat of an August day is a cool cruise on the Bosphorus, which is a great sightseeing option anyway. You can do that very inexpensively by public ferry. Or take a more expensive tourist cruise for 2 or 3 hours. You may wish to have a jacket for the breeze.
Or plan a siesta and go back out later to enjoy the cooler evenings.