Markets work best when there are a number of firms that must compete with one another. For some goods and services, that level of competition is impractical or impossible because of the high amount of infrastructure required. It wouldn’t make much sense for each company to build a completely separate set of water purification and distribution systems—it would be very expensive and take up a lot of space.
In many areas of the US we have a bizarre setup where there is a government enforced monopoly where a single company can reap all of the profits. This often leads to poor service because the company has very little incentive to provide value to its customers. Government owned services can be flawed as well but at least they are directly accountable to their citizens instead of a board or shareholders.