I remember riding the subway in London many years ago. Over and over on the PA system you would hear the words -- "mind the gap." This warning referenced safety when getting on or off the train.
There is another kind of gap that enhances safety. At a potable water system, you do not want the sewer system, or gray water for that matter, contaminating the fresh water supply. It is necessary to avoid cross-connections.
The cross connection that I see most frequently in my area involves water heater temperature-pressure relief valve drain lines that are routed down below the flood rim of a plumbing trap that connects to the sewer line. This is, also, seen at trap seal primers that are installed to keep infrequently used traps from going dry. Below is an unsanitary cross connection.
That piping, with the yellow on it, comes from the water heater.....potable water. The pure white drain line goes back to a furnace and different less strict, but specific, rules apply to HVAC condensate drains that discharge into plumbing traps.
To reduce the probability of cross-connections, "air gaps" (physical separation, 1" minimum space) are required between drain trap flood rims and lines that connect to the potable water system. If a trap is a receptor for discharge condensate from HVAC equipment, those drain lines must be installed with "air breaks" (lines may be below flood level of receptor but must be above trap seal).
I see this type of installation done wrong more often than not. Frankly, I do not know if HVAC technicians and plumbers are not well informed of this air gap requirement or if builders are skimping on costs and having their own workers go about this procedure in a haphazard manner.
The good news is that, regardless of the type of pipe used for the line, it is not too difficult to trim the pipe or otherwise modify the arrangement in a manner that establishes a proper air gap.