You don't describe the worm but it is most likely Round worm or Tapeworm. You should take the dog, or at least a fresh stool sample into the Vet to be checked. You need specific medications for certain types of worms. If you have other pets, digs/cats, you should check them also as they should probably be treated. If it is Tapeworm, which is caused by fleas, you need to get any flea issues addressed on the animal and the environment.
Hi there!
Worms are quite common, so there is nothing to worry about. However, you must take your dog to the Vet and have him determine what kind of worms your dogs has ... it's probably round worms,also known as pin worms. They tend to come out at night time. When you make your appt. with the Vet, they may want you to bring in a sample of your dogs stool. Then again, they may not. They will give your dog the appropriate medication to kill the worms and you and your dogs problems will be solved! Don't try buying any over the counter medication because it simply doesn't work. Just see a Vet as soon as possible. I wish you the best ... take care now!