The cattle aren't always helped by the egrets. They aren't always harmed, either. Sometimes one population does harm another population. A tapeworm cannot live on its own. It lives inside the body of another organism.
Tapeworms are parasites.
A parasite is an organism that lives on or in another organism called a host. A host is an organism that a parasite lives on or in. Some animals help plants reproduce. Squirrels bury oak tree seeds called acorns in the ground. Most of the acorns get eaten by the squirrels, but some stay buried and grow into trees.