What type of worms do you think she has?
How close is your dog to her whelping date?
Are these worms about the size of a grain of rice? Or maybe a little smaller?
Do they wiggle or elongate themselves when moving?
Yes, that is exactly what they appear to be like.
Praziquantel is the medication used to treat tapeworms (the type you seem to be describing). This medication is listed to be safe in pregnant and nursing dogs.
But all of the safety information puts this in vague terms such as "unlikely to pose harm to nursing offspring" and "considered safe to use in pregnant dogs or cats." So yes you can use this medication but I would still recommend waiting until she has whelped so you can dose her correctly.
Dosage is by body weight and you do not need to treat the puppies. If you dose her after she has whelped you will use less medication and have a more accurate treatment.
If there is anything else I can answer please let me know.