Let $(X,\mathcal{E},\mu)$ be a measure space. In general, if $f,g:X\to\mathbb{R}$ are both measurable with respect to $\mathcal{E}$, integrable, and satisfy
$$
\int_A f\,\mathrm d\mu =\int_A g\,\mathrm d\mu,\qquad \text{for all } A\in\mathcal{E},
$$
then $f=g$ almost everywhere with respect to $\mu$. In fact, it is enough to require the identity for all $A$ in some $\cap$-stable generator of $\mathcal{E}$.
In particular, if you let $(X,\mathcal{E},\mu)=(\mathbb{R},\mathcal{B}(\mathbb{R}),\lambda)$ where $\lambda$ is the Lebesgue measure, then if $f,g:\mathbb{R}\to\mathbb{R}$ are Borel measurable, integrable, and satisfy
$$
\int_A f\,\mathrm d\lambda=\int_Ag\,\mathrm d\lambda,\qquad\text{for all }A\in\mathcal{B}(\mathbb{R}),
$$
you can conclude that $f=g$ almost-everywhere with respect to $\lambda$. Again, it is enough to require the identity e.g. for all $A$ of the form $[a,b]$, $a<b$. Note that you can never be sure of pointwise identity.