I'm just starting out in calculus, so please bear with me if this is not a sensible question.
In the book I'm reading, the author gives the example of the problem of finding the limit of $\lim\limits_{x\to 5}(\frac{x^2 - 25}{x-5})$, because if you substitute in $x=5$, you get a denominator of $0$, so the output of the function at $x=5$ is undefined.
He then goes on to demonstrate how by factoring this equation to $\lim\limits_{x\to 5}(x+5)$, you can now plug in $x=5$ to get $\lim\limits_{x\to 5}(x+5) = 10$.
But is not the fact that 'at $x=5$ the function is undefined' an integral part of the original function? By factoring it, have you not added to the domain of the original function and therefore created a different function? So now you have the limit of a different function?