It's all a little bit of a balancing act and my understanding is probably simplified.
Burning wood generates a lot more PMs than clean electricity and gas but any CO2 released can be absorbed by a replacement tree. If you are in a rural area where PMs are not a big issue then burning wood can probably be considered better than burning gas (although potentially worse than truly green electricity)
Burning gas meanwhile produces fewer PMs (although IIRC still quite a high level of NOs) but any CO2 released has been locked up for millennia and so it is harder to undo the damage to the atmosphere. In urban area it is probably better (for us) than wood as it doesn't have the same detrimental effect on air quality.
Electricity meanwhile can be very clean by almost all measures depending on how it is generated. Unfortunately it currently costs about three times as much as gas and so using it to heat a typical UK house is expensive.
Of course I have ignored the cost of production for the generation equipment required for green energy. It may still be very low over the lifetime but is not pollution free.