Loperamide
Loperamide is an opioid receptor agonist that acts on the gut wall, slowing intestinal transit so that more water is reabsorbed and stools become firmer. At normal use it barely enters the brain, so it does not produce opioid effects centrally. It is an over-the-counter treatment for acute non-infectious diarrhoea.
It can be taken with or without food, but only for short courses: prolonging use masks a problem rather than resolving it. It is not appropriate for infectious diarrhoea, where slowing the bowel traps the organism and can make matters worse — fever or blood in the stool points that way. Loperamide can prolong the QT interval on the ECG, which matters when it is combined with other QT-prolonging medicines or when heart rhythm is already a concern, and this risk rises sharply if the usual amount is exceeded.
See a doctor if diarrhoea persists beyond a couple of days, or if there is fever, blood or mucus in the stool, severe abdominal pain, bloating, or palpitations, fainting or an irregular heartbeat.
Reference information, not medical advice. Discuss any change with your doctor.