When a client requests a connection to a server using the TCP protocol, 1- the client sends a packet with the synchronise flag (SYN) set to indicate that the connections should synchronise their timers. 2- The server then responds with an acknowledgement (ACK) flag to indicate it has received the client request as well as the SYN flag to establish the synchronisation with the client, 3- then the process ends by the client sending the ACK flag again confirming once for all that the nodes (client and server) are synchronised and ready to start sending and receiving data to each other making sure that every single package is send and received during the process.
This connection is required whenever the nodes need to exchange information ,which, every package send to each other is important, for example, if you are accessing a blog you expect to see all text and images that are supposed to be displayed to you (TCP is essential), on the other hand, if you are watching a live stream on youtube you need the information as fast as possible to be displayed to you, otherwise, the video would take to long to be streamed, therefore, causing an inconvenient delay. That is why video stream platforms usually use the UDP protocol instead, making the information available to the end-user much quicker for the cost of not getting every single data from it.
And that is how and why we use UDP and TCP , again that is only a high level overview of how they work, the whole process is much more complex and requires a lot of small steps which were not shown. But again hope I have helped you somehow. As always have a great day 🙂