If they're clean and not too sharp - hence the popularity of materials like silicone which is very easy to clean and flexible - then dildos are safe for use in the vagina. For anal use, you want something with a flared base, so it doesn't disappear inside you, and not to put it in a vagina without cleaning it / a new condom afterwards.
Distraction - keeping busy with other stuff - is the classic way.