Dear Student,
CO2 and water are formed in a combustion reaction (when a hydrocarbon reacts with oxygen).
CH4+2O2 → CO2+ 2H2O.
But, CO2 and water are also formed when a base like sodium bicarbonate or sodium carbonate reacts with an acid.
NaHCO3(aq) + HCl(aq) → NaCl (aq) + CO2(g) + H2O(l) (reaction between sodium bicarbonate and hydrochloric acid)
Na2CO3(aq) + 2HCl(aq) → 2NaCl (aq) + CO2(g) + H2O(l) (reaction between sodium carbonate and hydrochloric acid)
Regards