Non-precious metal-based electrocatalysts with high activity and stability for efficient hydrogen evolution reactions are of critical importance for low-cost and large-scale water splitting. In this work, Mo2C-Mo3C2 heteronanowires with significantly enhanced catalytic performance are constructed from an MoAn precursor via an accurate phase transition process. The structure disordering and surface carbon shell of Mo2C-Mo3C2 heteronanowires can be precisely regulated, resulting in an enlarged surface area and a defect-rich catalytic surface. Density functional theory calculations are used to identify the effect of the defective sites and carbon shell on the free energy for hydrogen adsorption in hydrogen evolution. Meanwhile, the synergistic effect between different phases and the introduced lattice defects of Mo2C-Mo3C2 are considered to enhance the HER catalytic performance. The designed catalyst exhibits optimal electrocatalytic activity in both acidic and alkaline media: low overpotentials of 134 and 116 mV at 10 mA cm-2, a small Tafel slope of 64 mV dec-1, and a long-term stability for 5000 cycles. This work will provide new insights into the design of high-efficiency HER catalysts via interfacial engineering at the nanoscale for commercial water splitting.