It is a sin but it doesn’t affect the wudhu unless something is emitted from the private parts.

When touching or handshaking a non mahram accidentally or  intentionlly, does a person still have his or her wuthu?

Mahram |