From the brief information you have provided, it appears that you might be suffering from an intestinal infection caused by the tape worm, Taenia saginata or Taenia solium. The person suffering from Taenia infections usually expel segments of the flat worm in batches. Some segments by their active movement crawl out of the anus on to the peri anal skin to be dropped off in the stool mass.
However, this needs to be confirmed by microscopic examination of the stool. Diagnosis can be made by demonstration of eggs and, less frequently, segment in the faeces. Since the eggs of both T. saginata and T. solium are similar, the species diagnosis cannot be made on the basis of the eggs alone. The species diagnosis is made by identifying gravid segments and examination of the scolex, a part of the worm.
Taenia infection produces clinical manifestations which are non specific and mild. They cause nausea, abdominal discomfort, hunger pain, loss of weight, chronic indigestion, etc. Abdominal pain, nausea are more common in the morning. This segment is found around anus in the day time causing psychological distress.
This condition can be treated well by praziquantel. It is the drug of choice for both T. saginata and T. solium intestinal infections. The drug is effective in a single oral dose of 10 mg/g/body weight. It is very safe. It may produce occasional side effect such as abdominal discomfort, nausea and head ache. Niclosamide is another safe and effective drug in a single oral dose of 2g. Hence, you are advised to get your stool examined first. If the stool shows the presence of the eggs and segments suggestive of T. saginata or T. solium, you can be treated with the drugs, as mentioned earlier.