The root cause in my case was that I had multiple similar redirect URIs registered in the Azure app. When I removed all unnecessary redirect URIs except for https://localhost:5267, the issue was resolved.
If you're facing the same HttpListenerException, I recommend checking your Azure AD app registration and ensuring that only the correct redirect URI is configured.
Hope this helps!