From the description that you have given I would suggest that your dog has tape worms. Tape worms attach to the lining of the intestine and this is where they multiply. As they mature, they break off and pass in the stool.
Animal's get tape worm from biting fleas. Once the larvae is ingested it begins to grow. While there are over the counter medications that are available at pet and department stores, they are not usually effective.
It would be in the best interest of your pup to see the vet. You will want to take a stool sample along in order that it be examined under the microscope. The tape worm when present is easily distinguished by the naked eye; however, there are other parasites that live in the intestines of our canine family members that can only be seen under magnification. If more than one parasite is noticed your vet will be able to treat all of them at once.
If this information has been helpful to you then please do ACCEPT. Let me know if I can help you further. Positive feedback is always appreciated.