In contrast to lithium-ion batteries, lithium–sulfur batteries have higher theoretical energy density and lower cost, so they would become competitive in the practical application. However, the shuttle effect of polysulfides and slow oxidation–reduction kinetics can degrade their electrochemical performance and cycle life. In this work, we have first developed the porous FeNi Prussian blue cubes as precursors. The calcination in different atmospheres was employed to make precursors convert into common pyrolysis products or novel carbon-based phosphides, and sulfides, labeled as FeNiP/A-C, FeNiP/A-P, and FeNiP/A-S. When these products serve as host materials in the sulfur cathode, the electrochemical performance of lithium–sulfur batteries is in the order of S@FeNiP/A-P > S@FeNiP/A-S > S@FeNiP/A-C. Specifically, the initial discharge capacity of S@FeNiP/A-P can reach 679.1 mAh g−1 at 1 C, and the capacity would maintain 594.6 mAh g−1 after 300 cycles. That is because the combination of carbon-based porous structure and numerous well-dispersed Ni2P/Fe2P active sites contribute FeNiP/A-P to obtain larger lithium-ion diffusion, lower resistance, stronger chemisorption, and more excellent catalytic effect than other samples. This work may deliver that metal–organic framework-derived carbon-based phosphides are more suitable to serve as sulfur hosts than carbon-based sulfides or common pyrolysis products for enhancing Li–S batteries’ performance.