The rational design of low-cost, efficient, and stable heterojunction catalysts for pH-universal hydrogen evolution is attracting increasing attention towards a sustainable hydrogen economy. Herein, a sequential spatial restriction-pyrolysis route is developed to confine Mott-Schottky-type Co-Co2P heterojunctions embedded in the one-dimensional (1D) carbon nanotube-modified three-dimensional (3D) N,P dual-doped carbon matrix (Co-Co2P@CNT//CM). The synergistic effect between the abundant Mott-Schottky heterointerfaces and the 1D/3D dual carbon confinement system enables fully exposed active sites and facilitated charge transfer dynamics, thus triggering favorable electronic structures of Co-Co2P@CNT//CM. As a result, Co-Co2P@CNT//CM heterojunctions exhibit excellent pH-universal hydrogen evolution reaction (HER) performance with overpotentials of 142, 205, and 262 mV at 10 mA cm−2 in 0.5 M H2SO4, 1.0 M KOH, and 1.0 M phosphate buffer saline (PBS), respectively. The theoretical results demonstrated that the Mott-Schottky effect can induce an oriented interfacial charge exchange between Co and Co2P. This can lower the reactive kinetic barrier and endow Co-Co2P@CNT//CM with ideal hydrogen adsorption free energy, which efficiently drives the production of H2 from electrolytic water.