Constructing heterogeneous electrodes to confront various electrochemical and structural requirements is demonstrated to be crucial for improving the sodium and lithium storage performances. Herein, a novel design of ZnS/Co heterostructures is expounded with abundant phase boundaries encapsulated in highly-conductive N/S-doped “pinecone”-like carbon framework (ZnS/Co@NSC-450) as a superior anode for sodium ion batteries (SIBs) and lithium-ion batteries (LIBs). In ZnS/Co@NSC-450, the ZnS/Co heterostructures can improve the electronic conductivity of material and stabilize the electrode structure integrity during cycling, while the N/S-doped “pinecone”-like carbon is beneficial for alleviating the volume expansion effect of active materials, providing additional active sites for sodium/lithium storage and ensuring the rapid electron/ion transfer across the electrode. Due to the synergistic effect of multiple components, both the SIBs and LIBs with ZnS/Co@NSC-450 anodes exhibit high-rate capability (476 mAh g−1 at 6.4 A g−1 for SIBs and 387 mAh g−1 at 12.8 A g−1 for LIBs) and outstanding long-term cycling stability (557 mAh g−1 at 2 A g−1 for SIBs after 1500 cycles and 767 mAh g−1 for LIBs after 1000 cycles). These results disclose the promising potential of ZnS/Co@NSC-450 toward high-performance SIBs and LIBs.