They work similarly - both act on the opioid receptor in the gut. Imodium is said to increase anal sphincter tone, though it doesn't do that for me, I think. Imodium is OTC while Lomotil is a controlled substance (at a modest level of control). Lomotil is a little more like the other opioids; for example, it reduces withdrawal symptoms in opioid addicts. Lomotil has a bit of atropine added, which is usually fine at the prescribed doses but (by design) very unpleasant at higher doses.
Neither of these drugs seem to carry the risks with long term use associated with their cousins that are used for pain relief (morphine, oxycodone, codeine, etc.).
I suggest you try both and see which one works better for you.