Is there any cross compatibility between 51515 and 31313?
It is possible to communicate between the 31313 and 51515 hubs.
See these youtube videos:
https://www.youtube.com/watch?v=PT4_4v1W2C8
https://www.youtube.com/watch?v=p3uk80tuqI4
In the first video a SPIKE Prime hub (same as 51515 just different firmware) is used to control a 31313 hub and in the second video there's more of explanation of how it's done.
I do not think that currently there is any compatibility between sensors. So you would need to use the 31313 hub to handle all its sensors and motors, which you could then communicate with or control from the 51515 (which is handling its own sensors and motors).