
You are working on a distributed service that exchanges traffic between clients, edge nodes, and backend systems. A new feature needs low-latency communication for some paths, while other paths must guarantee ordered and reliable delivery. During testing, you notice packet loss on one path and increased latency on another, and the team is debating whether the protocol choice is part of the problem.
Explain the detailed differences between TCP and UDP, and describe how you would decide which one to use for different traffic patterns in this system. Be explicit about the operational trade-offs you would expect in production.