Residual low back and leg pain can occur after percutaneous endoscopic interlaminar discectomy (PEID) and compromise early surgical outcomes. This study aimed to determine the efficacy of combining dexamethasone with vitamin B12 (VB12) via epidural injection in improving the symptoms of low back and leg pain after PEID, and the underlying mechanism of action. Patients who underwent PEID for lumbar disc herniation (LDH) were enrolled and randomly assigned to the single surgery (SS) group, where disc removal was performed via PEID alone, or the combined treatment (CT) group, which received epidural injections of dexamethasone and VB12 alongside surgery. The outcome measures were the Visual Analog Scale (VAS), Japanese Orthopaedic Association (JOA) score, Oswestry Disability Index (ODI), serum inflammatory factor expression, adverse surgical events, duration of postoperative hospitalization, and modified MacNab criteria. Compared with the SS group, the CT group exhibited lower VAS scores for low back and leg pain at 1, 3, and 7 days post-surgery (P < 0.05). JOA and ODI scores were significantly improved in the CT group than in the SS group 7 days post-surgery (P < 0.05); however, no significant differences were observed at other time points. Serum inflammatory factors were lower in the CT group than in the SS group 3 days post-surgery (P < 0.05). The duration of postoperative hospitalization was shorter in the CT group (P < 0.05). Both groups had similar good outcomes (89.3% vs. 92.2%, P = 0.945). Epidural injection of dexamethasone and VB12 effectively reduces early postoperative low back and leg pain, lowers postoperative inflammatory factor expression, and improves early PEID outcomes. Its clinical adoption merits consideration. This trial was registered with the China Clinical Trial Registration Center (Identifier: ChiCTR2400088854).