A 45-year-old man presents with long-standing epigastric discomfort and altered bowel habits. He also reports weight loss of 6 kg over 3 months and intermittent rectal bleeding. Examination shows pallor but is otherwise unremarkable. What is the most appropriate next investigation?