happy to provide you with some troubleshooting steps to get this sorted.
1. Reset your phone's network settings from Settings> General management> Reset network settings> Reset settings.
Once done, try to connect to your Wi-Fi again. Keep in mind that this option will delete any settings saved on the phone related to Wi-Fi, mobile data, and Bluetooth devices.
2. If the issue persists after that, check if you have any power saving settings enabled from Settings> Device care and battery> Battery> Power mode.
3. Place the phone in Safe Mode to see if any third-party app is affecting this. To do this press and hold the Power button until you see Power Off, Restart and Emergency. Press and hold the Power Off icon until it shows a Shield, tap the Shield and the device will restart in Safe Mode. Safe Mode disables all third party apps and so if this starts working in this mode, we can confirm it is being blocked by a third party app. If so, you will need to locate and either uninstall or contact the app developers for a fix.