Haldir’s role in the Lord of the Rings movies is much larger than what appears in the books. In the novels, Haldir was tasked with guarding the borders of Lothlórien.
While he does an admirable job of that, intercepting the Fellowship as they enter the forests of Lothlórien,
he was given more responsibility in the movies.
In The Two Towers, at the behest of Galadriel and Elrond, Haldir is asked to lead an army of Elves in defense of the Rohirrim who are being attacked at Helm’s Deep.
He fights valiantly, side-by-side with Aragorn, and while the Rohirrim suffer massive losses in the battle, Haldir’s presence and that of his fellow Elves help Theoden’s people make it through the night until Gandalf and his reinforcements show up.