Capacitor voltage rating in a zener-only stabilized mains supply - 35 V rating OK for 24 V?
In this case (a Zener-only stabilized mains supply) capacitor cyclic charge and discharge.

Charge through D3 when a half-wave voltage is positive. Discharge on load when a half-wave voltage is negative. Сurrent through the capacitor is essential(appreciable).

Usually, Equivalent series resistance (ESR)  is inversely proportional to the voltage rate of the capacitor at constant capacity.
ESR a 220µF/35V capacitor has greater value as a 220µF/50V capacitor.

Cyclic current and ESR greater value lead to greater heating of the capacitor and this reduces durable.

My opinion is replacing permissible but not justified. I do not recommend.