A 78-year-old woman with advanced dementia in the last days of life becomes increasingly agitated and distressed, pulling at lines and shouting. Reversible causes have been addressed. What is the most appropriate pharmacological option for managing her agitation?