As per my understanding, for a function to be Riemann integrable the difference $U(P,f)-L(P,f)$ must be less than $c$ for any $c>0$
let’s take function $f(x)=x \ if \ 0\leq x<1$ and $f(x)=2 ,\ if \ 1\leq x\leq 2$
then at partition containing $x=1$, the difference $U(P,f) - L(P,f)$ is not less than $c$ (for any $c>0$)
then why is it Riemann integrable?
Hint for the example you mentioned: Let $\epsilon>0.$ There is a partition $P$ of $[0,1-\epsilon]$ such that $U(P,f) - L(P,f) < \epsilon.$ And there is a partition $Q$ of $[1+\epsilon,2]$ such that $U(Q,f) - L(Q,f) < \epsilon.$ How big can $U(P\cup Q,f) - L(P\cup Q,f)$ be?