Cogeneration would be much better for sure. In most countries heating with natural gas ends up being less carbon (after losses). But in France even resistive heating could be viable from a carbon perspective.
To be clear you should never do this, you should use a heat pump. But you could and it wouldn't be the end of the world.