Yes, as long as the user from the one tenant are guest users in the other tenant and have access to the application, this should work just fine. You can also add the users to the app itself.
I recommend reading the guides on multi-tenant apps.
For configuring a new multi-tenant app: https://learn.microsoft.com/en-us/azure/active-directory/develop/setup-multi-tenant-app
For converting an existing app to be multi-tenant: https://learn.microsoft.com/en-us/azure/active-directory/develop/howto-convert-app-to-be-multi-tenant