I'm not sure about the "changing into a worm" part, but the creature you could be talking about is the parasitic worm, which belongs to a group of parasites called helminth.
They target humans and other animals, and some live in their in intestines of their hosts for long periods of time.Otherwise, when it comes to insects burrowing in flesh, the one thing that comes to mind is the human bot fly.
The female lays its eggs on other insects like mosquitoes, and they hatch when they come in contact with the heat of an animal's skin. Sometimes they enter the body through the mosquito's bite. Other times they use mandibles to burrow through the skin.
They live their causing little trouble