iPhone got wet from rain and now keeps shutting off

had to run home cause it was raining. sadly i didn’t have a jacket or pockets so my iphone was getting pretty wet.

i got home and it was still working just fine.

but now it keeps shutting off randomly

and also saying temperature too hot i have to wait to use it even though the phone is cold and it was shut off what do i do?