The aim of this study is to conduct a comparative analysis of the therapeutic outcomes associated with the administration of remimazolam and propofol during painless endoscopic retrograde cholangiopancreatography (ERCP) procedures in older adults. A total of 140 older adults who underwent elective painless ERCP were randomly assigned to two groups using the random number table method: the remimazolam group and the propofol group, each consisting of 70 patients. In the remimazolam group, anesthesia was administered using a combination of remimazolam and opioids, while in the propofol group, a combination of propofol and opioids was used. Comparative assessments between the two groups included anesthesia induction time, first induction success rate, intraoperative hemodynamics, awakening duration, stress response index, and the incidence of adverse reactions. The remimazolam group exhibited a prolonged anesthesia induction time compared to the propofol group and a lower success rate of first induction (P < 0.05). At the point of endoscope entry (T2) and 10min post-operation (T3), patients in the remimazolam group demonstrated higher mean arterial pressure (MAP), heart rate (HR), and bispectral index (BIS) values compared to those in the propofol group (P < 0.05). Furthermore, the remimazolam group had shorter durations for eye-opening, consciousness recovery, and residence in the recovery room compared to the propofol group (P < 0.05). Post-surgery levels of epinephrine (E), norepinephrine (NE), and cortisol (Cor) at 24h were lower in the remimazolam group than in the propofol group (P < 0.05). The incidence of adverse reactions was significantly lower in the remimazolam group (18.57%) compared to the propofol group (31.43%) (P < 0.05). Remimazolam exhibits a longer induction time compared to propofol in the painless diagnosis and treatment of ERCP in older adults. However, it provides a more stable circulatory state post-induction and throughout the operation, reduces stress response, enables rapid recovery, and has a lower incidence of serious adverse reactions. These attributes suggest that remimazolam has potential for widespread clinical application and adoption. clinicaltrials.gov, identifier ChiCTR2400080926.