I don't know anything about worms but what I can say is that my now 4 year-old used to thrash and cry all night in her sleep when she was 2 and 3. This eventually stopped and she now sleeps like a block. My three-year old also cries a lot in her sleep although her thrashing is not as bad. I am wondering if this is a normal phase that toddlers go through.
She may have intestinal worms. They are most active at night and can cause restless sleep. Some people have no symptoms at all but some are badly affected. I deworm my whole family every 3 months. They are so easy to get, at least 70 % of people have them. Gross, but a fact of life! Just google for more info and medicine can be bought over the counter at the pharmacy.