The rice in the rice trick doesn’t do anything useful. You could build a shrine to the Flying Spaghetti Monster on your kitchen counter and place the phone in the center of the shrine and have the same success rate.
Take the battery out. If you can’t take the battery out, don’t turn the phone on. Damage occurs when water shorts out circuit paths and allows electricity to go places it wasn’t designed to go in the phone, so the best thing that you can do is remove the source of the electricity. After that, just let the phone dry out. Rice is a mild desiccant, so if you live in a humid area, sticking the phone in a can of rice will help it to dry out slightly faster (only slightly though, and then only if you live in a humid area). Otherwise, the rice has no affect at all on the phone, and even if you do live in a humid area, the rice only helps it dry out a bit faster. It doesn’t affect whether or not the phone will survive.
People hear about the rice trick and try it on their phones. If the phone survives, they think that the rice is the reason that it survived. The rice had nothing to do with it.
Baking the phone, as Mr. Duality posted, will help it dry out faster (much more effectively than rice), but if you bake it at too hot of a temperature you’ll ruin the phone just from the heat. Since this has a danger of damaging your phone, I generally don’t recommend it.