Thanks for providing additional details about the issue.
Since you mentioned that the issue happens intermittently (Wi-Fi is working normally and then disconnecting later,) try resetting network settings on your iPhone:
Reset your Network Settings. Tap Settings > General > Reset > Reset Network Settings. This also resets Wi-Fi networks and passwords, cellular settings, and VPN and APN settings that you’ve used before.
This step comes from the Support article If your iPhone, iPad, or iPod touch won’t connect to a Wi-Fi network .
Let us know if this improves the behavior when connecting to Wi-Fi networks.
Best Regards.