Constructing a unipolar heterojunction is an effective energy band engineering strategy to improve the performance of photoelectric devices, which could suppress dark current and enhance detectivity by modulating the transfer of carriers. In this work, unipolar heterojunctions of Si/PbI2 and GaSb/PbI2 are constructed successfully for high-performance self-powered near-ultraviolet photodetection. Owing to the unique band offset of unipolar heterojunctions, the transport of holes is blocked, and only photogenerated electrons in PbI2 can flow unimpeded under the driving force of the built-in electric field. Thus, the recombination of photogenerated electron-hole pairs is suppressed, contributing to high-performance near-ultraviolet photodetection. The as-fabricated Si/PbI2 self-powered near-ultraviolet photodetector exhibits a low dark current of 10-13 A, a high Ilight/Idark ratio of 104, and fast response times of 26/24 ms, which are much better than those of the PbI2 metal-semiconductor-metal photodetector. Furthermore, the as-fabricated GaSb/PbI2 unipolar heterojunction photodetector also exhibits impressive self-powered near-ultraviolet photodetection behaviors. Evidently, this work shows the potential of unipolar heterojunctions for next-generation Si-based and GaSb-based high-performance photodetection.