Your iPhone could indeed have a WiFi radio or antenna problem. If that is the case, then you should take it into an Apple Store to have the hardware tested.
However, the same symptoms could also be caused by a poor WiFi signal or interference from other nearby WiFi networks. To make sure that this is not the case, try your iPhone in an isolated building that has reliable WiFi such as a public library. If your iPhone has the same problem there, then you need to take it in for a hardware check. If it works reliably there, then you need to diagnose your home WiFi network.