Consider a question : Find the range of $f(x)= \frac{x^2 - 4}{x - 2} $
I found two methods for solving this
Method 1: The domain of this function is $\mathbb{R} - {2}$ .So if $x$ is not equal to $2$ , $f(2)$ does not lie in the range $f(2)=2+2=4$
THEREFORE range=$\mathbb{R}-{4}$
Method 2 Let $\frac{x^2- 4}{x-2} = y \iff x^2-4=xy-2y \iff x^2-(y)x-(4-2y)=0$ as $x$ is real ${ b^2 -4ac\ge 0}$ $ y^2+4(4-2y)\ge 0 \iff (y-4)^2 \ge 0$
THEREFORE range is ${\mathbb{R}}$
Two different ranges
The first method doesn't make sense: since $2$ does not blong to the domain of $f$, $f(2)$ is meaningless.
For the second method, you seem to have forgotten that $2$ does not blong to the domain of $f$. Besides, if $x\neq2$, $\frac{x^2-4}{x-2}=y\iff x+2=y$. But, since $x$ can be any real number other than $2$, $y$ can be any real number other than $4$. So, the range is $\mathbb R\setminus\{4\}$.