Substituent effects on acidity
(1) It is true that the inductive effect is weak across several bonds, BUT conjugated bonds (i.e. alternating simple and multiple bonds) propagate this effect much farther, even more for mesomeric effects. You can think of "conjugated bonds" like a tunnel for electrons.

(2) In your case, the electronic effects will stabilize the salt more/less than the acid. As they are in equilibrium, the salt is more/less favored than its acid counterpart.

I think that the most important thing here is that the more electric charges are "diluted" (i.e distributed among more atoms), the more stable a molecule is. This is an effect of entropy, which is too often poorly described as disorder.