There are two ways that water can make you sick.
One is just a new set of not-particularly-dangerous bacteria. This can happen even in places with safe water supplies, and is why locals can sometimes drink the water when newcomers can’t. This you can get used to. I’d imagine the water in Mexico City is more along these lines, but you’d have to research to know for sure.
The other is when there are disease-causing pathogens in the water, and this you can’t get used to. A lot of people in this world have diarrhea basically all the time, and diarrheal diseases are still a major killer among children. A healthy adult with access to medical care is unlikely to die from bad water (although there are indeed a handful of really horrific things that can happen) but they will spend a lot of time pretty miserable.
Living as a Peace Corps volunteer in Cameroon, we were supposed to boil and filter our water. Some people did this. Most gave up on boiling and just filtered. A few just drank whatever and hoped for the best- it’s hard to refuse a nice cup of water from a neighbor when it is 120 degrees out.
All of us were sick some of the time. Those with bad habits were sick quite a bit more. Now and then someone would get typhoid or something really nasty and would have a few bad weeks. There were a few horror stories (the guy who got eggs laid in his brain!) but those were relatively rare. So while you could choose to drink the water and most likely be fine in the end, you will probably get sick a lot more often and be accepting some degree of serious risk.
Watching the locals can be a good way to understand the risks- many cultures have developed habits like peeling fruit, drinking boiled water, etc. But it’s not always reliable. It could be that they can’t afford the fuel to boil water, or that they are engaging in practices that were fine 20 years ago when they lived in remote villages but are problematic in urban areas.