Sony says you shouldn't use the Xperia XZ1 and XZ1 Compact underwater, despite them being water-resistant
"Xperia XZ1 is water resistant and protected against dust, so don’t worry if you get caught in the rain or want to wash off dirt under the faucet water, but remember all ports and attached covers should be firmly closed. You should not put the device completely underwater; or expose it to seawater, salt water, chlorinated water, or liquids such as drinks. Abuse and improper use of device will invalidate warranty. The device has been tested under Ingress Protection rating IP65/68. For more info, see www.sonymobile.com/waterresistant. Note the Xperia XZ1 has a capless USB port to connect and charge. The USB port must be completely dry before charging."
So, there you go. While the XZ1 and XZ1 Compact could very well survive being underwater for some time, it's probably better not to test that. This is (likely) because IP certifications are given following tests made in controlled laboratory environments - which may differ from, you know, real life.
Mind you, Sony says exactly the same thing about some of its previous water-resistant Xperia phones (including the Xperia XZ Premium): you shouldn't put them completely underwater. Thus, this isn't a recent change of policy, and yet we still thought customers needed to know, because not everyone reads all the footnotes.
In case you're wondering, manufacturers like Samsung and LG do not have cautions like this one when it comes to their water-resistant phones (including the Galaxy Note 8, Galaxy S8, V30, and G6). According to them, it's safe to use the handsets underwater up to 1.5 meters for no more than 30 minutes.
sources: Sony Xperia XZ1, Sony Xperia XZ1 Compact
Things that are NOT allowed: