You just need to make sure that you have both the localhost and production URL set in your Redirect URI list in your app registration, and that whatever you have in your application code matches one of these exactly (no missing spaces or slashes). Since this is just whatever URL you want your users to be directed to after signing in, you need to have the published production URL on hand and add it to the registration and the app configuration.
So the code will also need to have the published URL in it (https://myapp.azurewebsites.net)
string bootstrapContext = ClaimsPrincipal.Current.Identities.First().BootstrapContext.ToString();
UserAssertion userAssertion = new UserAssertion(bootstrapContext);
var cca = ConfidentialClientApplicationBuilder.Create(ConfigurationManager.AppSettings["ida:ClientID"])
**.WithRedirectUri("https://localhost:44355")**
.WithClientSecret(ConfigurationManager.AppSettings["ida:Password"])
.WithAuthority(ConfigurationManager.AppSettings["ida:Authority"])
.Build();
string[] graphScopes = { "https://graph.microsoft.com/Files.Read.All" };
For the issue with multiple Application ID URIs, as you mentioned you could solve that by having multiple app registrations for each environment, as described in this post.