This really needs to be put in an answer and not be buried in comments.
Your design, as described, is a law suit waiting to happen. I doubt it would pass a safety standard review.
You are describing a single connector carrying UART TX and RX, plus 230V AC mains hot and neutral.
First of all, a UART needs three wires: TX, RX and common. I have to assume you are using mains neutral as UART common. This is a disaster. Your country mains plugs better be polarized and even if it is, you never know when an outlet might be wired backwards. Connect UART common to 230 V AC will destroy your box and whatever is connected to the UART, was well as potentially electrocuting the user!
Even if you could guarantee the mains connection, the mains neutral can easily rise a few volts above ground potential if you have a heavy load on the circuit.
You also need to worry about creepage. You need to space the mains voltage far enough away from low voltage circuits (as well as between hot and neutral) to avoid arcing, especially if the PCB gets dirty. If you open up a small brand-name (not Chinese crap) AC to low voltage regulator, such as a mains-to-USB phone power supply, You will see that they have actually cut slots in the PCB to increase the effective distance between mains voltage and low voltage.
This is all ignoring your original question about avoiding accidentally connections mains hot to a UART terminal.
Please do yourself a big favor and redesign to use standard connectors. You probably want to put your mains voltage into a IEC C8 or C14 connector so a standard power cord can be used. For the UART, particularly is using RS232 signaling, a D Sub 9 pin connector is standard although people also use RJ11 and RJ45 connectors.