For R(z, w) rational with complex coefficients, of degree at least 2 in w, we show that the number of rational functions f(z) solving the difference equation f(z+1)=R(z, f(z)) is finite and bounded just in terms of the degrees of R in the two variables. This complements a result of Yanagihara, who showed that any finite-order meromorphic solution to this sort of difference equation must be a rational function. We prove a similar result for the differential equation f(z)=R(z, f(z)), building on a result of Eremenko.