The other answers are excellent and clearly explain that indeed anti derivatives of a function may differ by a constant. I wanted to add that your "problem" can be introduced both in a "forward" and a "backward" fashion.
You gave a "backward" example, that is when two clearly not equal functions upon differentiation produce the same function. But working the other way around can also introduce the "problem", that is integration of the same function (and omitting the constant) may still produce a constant difference in the resulting functions. To illustrate what I mean consider the following tempting conclusion
$$\text{Let } f(x) = x, g(x) = x \text{ then } f(x) = g(x) \text{ and } \int f(x)dx = \int g(x)dx$$
We now apply the results of integration theory on both sides of the equation (which should result in applying the same operations on the symbols, right?) and decide not to add an extra constant to either of both. If we let the resulting expressions be denoted respectively by $F(x)$ and $G(x)$, we might be tempted to say that $F(x) = G(x) = \frac{1}{2}x^2$, but this conclusion is also not entirely true because the results depend on the operations applied. Moreover, the applied operations might be (unknowingly) forced upon us by the form of the equation!
To see this, consider the differential equation $y' = y$. Suppose I have the solution $z = 2e^x$, now we might be tempted to say
$$ \frac{z'}{z} = 1 \rightarrow \int \frac{z'}{z}dx = \int dx \xrightarrow{\text{set both integration constants 0}} \log(z) = x \rightarrow z = e^x \rightarrow 2e^x = e^x $$
which is obviously false.
I have sometimes seen students struggling with this, so I thought I might as well add it. Hope it helps! :)