Here are some quotes from the Sony support page regarding waterproof devices:
Your device has an IP rating. This means that under a strictly controlled laboratory environment, the hardware works as designed even after being exposed to specific conditions. Sony devices that are tested for their waterproof abilities are placed gently inside a container filled with tap water and lowered to a depth of 1.5 metres. After 30 minutes in the container, the device is gently taken out and its functions and features are tested
.......Taking photos and movies in wet surroundings. Remember not to use the device underwater. If you accidentally get the device wet with non-fresh water, wash the device with tap water.
It appears that the phone is not as waterproof as what you think it is.
This has been substantiated by a lot of online reviews of the phone. You may wish to research this further.
As you know water and electronics and electricity are not a good mix.
The water causes corrosion and provides circuit paths for the electricity which were not in the phone's operating design and could damage the components.
Rice is good to eat but does nothing to fix the problems caused by corrosion
Don't Put Your Device in Rice. Here's Why
First do not turn on your phone and then you need to with the phone turned off, remove the battery as soon as possible from the phone to minimize further damage.''
Then you need to dis-assemble the rest of the phone and clean all the affected parts using Isopropyl Alcohol 90%+ (available from most pharmacies) to remove all traces of corrosion and water. Do not use "rubbing alcohol" as in some cases this is <70% IPA, can contain scents and is not as effective. If you do check the label to verify the amount
Here is a link that describes the process.
Electronics Water Damage
As always with electronics, especially surface mounted PCBs be gentle when handling and especially when brushing away the corrosion. You do not want to remove any components from the board.
Hopefully after you have done all this the phone might possibly work correctly again.
Here is a link to the ifixit Sony Xperia Z3 Compact Repair guides which may be of some help.
If this process seems too daunting, take your phone to a reputable, professional phone repair service, experienced in water damage repair and ask for a quote for a repair.
It may be that to have any chance at all of it working properly again that it needs to be repaired using equipment that the average person doesn't have, but a repair service does e.g. an ultrasonic cleaning machine.
If you decide to do this, do it sooner than later.