Is it safe to wash your iPhone with soap and water?
No, water isn’t safe for any electronics. Neither are cleaning products, including soap. 


https://support.apple.com/en-us/HT207123


Avoid moisture and clean as lightly and dryly as possible is best for the hardware - especially hardware that’s been used and bumped and dropped. Small cracks will grab water and soap, a surfactant, causes capillary action to be amplified. 

Even a new phone or waterproof one shouldn’t just be washed with excess water for no good reason. It really depends on the contaminant and ability to clean without a lot of water in the end. It also doesn’t mean a drop in a pool or sink will cause a phone to fail, especially the newer ones. 

Now, when choosing between your health and the phone health, most people will occasionally use something other than water, but only knowing it damages the device in excess or in concentration based on the cleaning product you choose.