Polymeric carbon nitride (PCN) is a promising class of materials for solar-to-chemical energy conversion. The increase of the photocatalytic activity of PCN is often achieved by the incorporation of heteroatoms, whose impact on the electronic structure of PCN remains poorly explored. This work reveals that the local electronic structure of PCN is strongly altered by doping with sulfur and iron using X-ray absorption spectroscopy (XAS) and resonant inelastic X-ray scattering (RIXS). From XAS at the carbon and nitrogen K-edges, sulfur atoms are found to mostly affect carbon atoms, in contrast to iron doping mostly altering nitrogen sites. In RIXS at the nitrogen K-edge, a vibrational progression, affected by iron doping, is evidenced, which is attributed to a vibronic coupling between excited electrons in nitrogen atoms and C-N stretching modes in PCN heterocycling rings. This work opens new perspectives for the characterization of vibronic coupling in polymeric photocatalysts.