It might not work since they’re different platforms with different APIs. The only way an app might work on both platforms is if the app itself chooses to support both APIs.
That said, there’s a level of interaction between the two since they both use ActivityPub. I.e. on Mastodon I can search for a particular Lemmy user and see their posts.
To me it’s how it focuses more on the UX - how content is presented and how you navigate and interact with it.