Many emulators have this functionality, called netplay. For example Mesen, one of the best NES emulators available:
https://www.mesen.ca/docs/tools.html#netplay
Also RetroArch (which has cores for many systems, including Genesis):
https://www.retroarch.com/index.php?page=netplay