Using din rail terminal to UART communication
It would be good if you used some kind of serial transceiver, like a MAX232 or whatever is trendy these days. The raw serial port from the MCU is:

Weak: 0 to 5V with some milliamp available;
Susceptible to noise: the input of a GPIO pin is very high impedance so it's very sensible to whatever passes by;
Quite frail: you are pulling out in a wiring cabinet an MCU pin, without protection from all surges and bad things that are out there.

If you use some serial transceiver shield, otherwise, you'll have no issues. Terminal block or DE9 (that would be the correct designation of the d-sub) are similar except for electrostatic shielding, if you are using a shielded cable.