These are habits and practices I have developed over the years as I wander the world as a senior with interesting blood.
I am a wanderer, not a doctor. Some of my ideas may not be suitable for you; select those which suit you and ignore those which don't.
Your body is used to your local water and your local bugs. I rarely stay in a country long enough to let my body acclimatise to its different bugs so I do not drink the local water. That does not just apply in the third world. I did not get Delhi Belly in India or Montezuma's Curse in Mexico but I did suffer from it in Cairo, Hong Kong, Peru and Texas.
I keep it simple. I buy bottled water with an unbroken seal. That has been available everywhere I have been in fifty countries and has never let me down. Some people use water filters. I do not. That is partly because they can be awkward to carry and use, but mainly because I can never be sure they are removing all the local bugs. Only if bottled water is not available in a remote area would I take a filter.
For fresh drinking water I only let bottled water pass my lips; that includes brushing my teeth and keeping my mouth shut in the shower.
I enjoy trying local beers and wines as I travel but I take care not to get drunk. It isn't worth the risk to me; not just to my health but also for security. It is too easy to become a sucker or a victim when judgement is impaired by alcohol.
As long as I observe that precaution I have never had health problems from drinking local brews or vintages; in fact beer is usually a good choice in tropical climates instead of the local water. I occasionally find local wines which would better serve as paint stripper but more often they are quite good.
I avoid ice in my mixed drinks or soft drinks unless I can be certain it is made from clean water.
As a lateral issue, before you open the water bottles in your hotel room double check whether they are complimentary. If there is a charge you will nearly always find a shop nearby selling water for a fraction of the hotel price.
Tea and coffee.
I do not avoid tea and coffee brewed from the local water. I presume the water has been boiled long enough to kill any bugs. So far that policy has worked for me.
Vegetables and Meats
I avoid fresh washed salad vegetables when travelling in places with questionable water. The water the vegetables are washed in may be more dangerous than the dirt washed off. I stick to well-cooked vegetables unless I washed the salad thoroughly myself with bottled water. On the rare occasions I decide to break that rule I try a small experimental portion at dinner and don't repeat it until I find my internal plumbing is in good working order the following morning.
When choosing cooked foods I always make sure soups and stews are well cooked and my meats are always well done. I like medium rare at home, but do not risk it when I'm overseas.
I often eat in the restaurants chosen by the locals rather than those intended for tourists but I use some common sense when doing so, looking at the general hygiene and cleanliness of the place before I order. I accept different standards in the third world. Only once have I regretted a local choice.
In every one of the four cases of traveller's curse I suffered I was able to identify the cause. Each time it was from carelessness with foods, usually salads or fruit. My rule for fruit these days is to only eat fruit I peeled myself.
When Mistakes Occur
I carry prescription Norfloxacin with me. It is a strong medication with possible side effects and should only be used if prescribed by your doctor. For me it is a magic pill when the traveller's curse appears. One pill is usually enough. On one occasion (Nasca, Peru) I took two but I would never exceed that dose. Discuss that with your doctor before your travels.