A 49-year-old man reports chronic heartburn and regurgitation, partially relieved by over-the-counter antacids. Over the last 2 months, he has developed dysphagia to solid foods and a 10-lb unintentional weight loss. What is the most appropriate next step in management?