How do I troubleshoot WiFi networking issues with my iOS 12.2 iPhone 8? Can't load apple.com
There are chances where your Wifi router doesn't support the Apple or in the wifi network there can be chances where you need to do make some changes.

But before that try to go to Settings -> General -> Reset and choose Reset Network Settings.

You’ll have to reconnect to all your Wi-Fi networks and enter their passwords again, so make sure you know the important ones before you begin. Try reconnecting to your wireless router after your iPhone reboots. If it still won’t connect, it’s time to take a look at your wireless router.