$\dfrac{x^2-3x-10}{x+2}\div\dfrac{x^2-25}{x}$ is our expression, so we can clearly see that $x \ne 0,-2. $ Also, we cannot have $x=5,-5$ because that would make the $2$nd fraction $0$, and we can't divide by zero. Thus, our restrictions are $x \ne -5,-2,0,5$. These restrictions must be kept throughout the whole process, or else our end product will be different from the start product. For example, $x^2$ and $x^2, x\ne 0$ are different graphs because the $2$nd one has a hole in the middle.
A more thorough explanation:
$$\dfrac{x^2-3x-10}{x+2}\div\dfrac{x^2-25}{x} = {\dfrac{x^2-3x-10}{x+2}\over\dfrac{x^2-25}{x}}$$
If we multiply the top and bottom by $x(x+2)$, you have to note that $\frac aa = 1$ is only true if $a \ne 0$, so we have to keep the restriction that $x \ne -2,0$
Thus, we get $$ {(x^2-3x-10)(x)\over(x^2-25)(x+2)}$$
Which becomes $$(x-5)(x+2)(x) \over (x-5)(x+5)(x+2)$$
When we simplify the ${(x-5)(x+2) \over (x-5)(x+2)}=1$ part, we have to note again that $\frac aa = 1 $ only when $a \ne 0$, so we have to keep the restriction that $x \ne -2,5$. Thus, we have finally simplified it down to $\frac{x}{x+5}$, which can't have $x=-5$. Thus, we have simplified, keeping all the restrictions that $x \ne 0,-2,-5,-5$