TCP and UDP ports can be the same, because both TCP and UDP are in the fourth layer of OSI, and the port number is the fourth layer, which means that the port is only data defined by TCP, and TCP and UDP ports are two transport layer protocols, which are maintained separately. Tcp maintains the port list of tcp and udp maintains the ports of udp, so there is no conflict and you can listen.
In addition, there is the SO_REUSEPORT option of tcp after linux 3.9 kernel, which is mainly used for load balancing, and it is also possible that two processes listen to the same TCP port.