Let's take an actual example. Suppose we wish to calculate $$I = \int_{0}^{1}x\,dx\tag{1}$$ As you can see the integral $I$ is easily evaluated with $I = 1/2$. Now let us put $x = u^{2} = g(u)$ in the above integral and the limits of integration will change to $u_{0} = 0, u_{1} = \pm 1$ and you wish to know which one of the values of $u_{1}$ is correct.
In order to answer this question recall the theorem for substitution in a definite integral
Theorem: If $g$ has a continuous derivative $g'$ in $[c, d]$ and $f$ is continuous on $g([c, d])$ then $$\int_{g(c)}^{g(d)}f(x)\,dx = \int_{c}^{d}f(g(u))g'(u)\,du\tag{2}$$
From the above theorem you can see that $c < d$ hence we need to choose $c = 0, d = 1$ so that $g(c) = 0, g(d) = 1$ and then $$I = \int_{0}^{1}x\,dx = \int_{0}^{1}u^{2}\cdot 2u\,du\tag{3}$$ Let us see what happens when we choose $d = -1$. In that case it is better to write $c = -1, d = 0$ (to ensure $c < d$). Now $g(u) = u^{2}$ is differentiable on $[c, d] = [-1, 0]$ and $g(c) = 1, g(d) = 0$ so it follows that $$\int_{1}^{0}x\,dx = \int_{g(d)}^{g(c)}f(x)\,dx = \int_{c}^{d}f(g(u))g'(u)\,du = \int_{-1}^{0}u^{2}\cdot 2u\,du\tag{4}$$ which is true as both sides evaluate to $-1/2$.
You need to use the theorem mentioned above very carefully and also ensure the conditions under which it works. Thus when you put $x = g(u)$ and wish to get limits $c, d$ for $u$ corresponding to $a, b$ for $x$ you must ensure that $c < d$ irrespective of the fact whether $a < b$ or not.
Further note that if reverse the limits of integration in $(4)$ then we again get $$I = \int_{0}^{1}x\,dx = \int_{0}^{-1}u^{2}\cdot 2u \,du$$ so that the restriction $c < d$ is not critical. What is critical is the continuity of derivative $g'(u)$ on interval containing $c, d$ and continuity of $f$ on $g([c, d])$ (or $g([d, c])$ as the case may be).
You can try to evaluate $\int_{4}^{9}x\,dx$ in similar manner by putting $x = u^{2}$ and here you will have two choices each for both $c$ and $d$. Thus we can see that $g$ is differentiable on $[-2, 3]$ and $g(-2) = 4, g(3) = 9$ and hence $$\int_{4}^{9}x\,dx = \int_{-2}^{3}u^{2}\cdot 2u\,du$$ and both sides evaluate to $65/2$. You can see that the same answer comes when we write the integral as $$\int_{2}^{3}u^{2}\cdot 2u\,du\,\text{ or }\int_{-2}^{-3}u^{2}\cdot 2u\,du\,\text{ or }\int_{2}^{-3}u^{2}\cdot 2u\,du$$