I remember having a similar question once, specifically pertaining to iOS. I was in contact with an MDM provider, and they told me that as long as you have your app signed and approved by Apple, you can choose not to publish it to the app store, and distribute it via URL instead. I think they said this could even work, without having these devices managed by an MDM system.
Here is an article I found on the subject: https://www.goodbarber.com/blog/distribute-your-ios-app-out-of-the-store-with-the-apple-developer-enterprise-program-a871/
Android should be easier in general, since distributing .APKs to install apps shouldn’t be a problem (the same way sites like apkmirror work).