If it looked like a grain of rice or a sesame seed, it is most likely tapeworm. Over the counter products will generally treat the tapeworms if there is Praziquantel in it.
However, the problem with over the counter treatments is that many aren't effective against ‘all' the possibilities. That's why a vet administered med is highly recommended. The vet can determine what kind of parasite (or parasites) your companion may have in addition to tapeworms and treat him accordingly with the latest prescription meds and accurate dose. Please see this link http://www.fabcats.org/worming.html
Other parasite info: