Note: The following solves the problem of maximizing the distance between two points, one on a line and one on a parabola, subject to a constraint. This is what the question above asks, although comments from the OP suggest that the intent was to maximize the difference of the $y$ values for a given $x$.
Here is another way:
Let $(x_1,x_1+2)$ be a point on the line and $(x_2,x_2^2)$ be a point on the parabola. Maximizing the distance is equivalent to maximizing the square of the distance, and the square is more tractable. So, we want to maximize $f(x_1,x_2) = (x_1-x_2)^2+(x_1+2-x_2^2)^2$, subject to $ x_1, x_2 \in [-1,2]$.
First, notice that the function $x_1 \mapsto f(x_1,x_2)$ is always a convex quadratic (ie, a quadratic in $x_1$, and the square term has a non-negative multiplier), regardless of the value of $x_2$. A convex quadratic on a closed interval takes its extreme value at the boundary of the interval. In this case, that gives, $\max(f(-1,x_2),f(2,x_2)) \geq f(x_1,x_2)$. Hence we may presume that $x_1 \in \{-1,2\}$. To find a solution we can maximize $f$ with $x_1$ set to $-1$, and again with $x_1=2$ and pick the maximum value.
Let $f_1(x_2) = f(-1,x_2), f_2(x_2) = f(2,x_2)$. Expanding these gives $f_1(x_2) = (1-x_2^2)^2+(1+x_2)^2$, $f_2(x_2) = (4-x_2^2)^2+(x_2-2)^2$.
We have $f_1'(x_2) = 2(x_2+1)(2x_2^2-2 x_2+1)$. The latter factor has no real roots, hence $f_1$ is non-negative, and is monotonic on the intervals $(-\infty,-1]$ and $[-1,\infty)$. Hence the maximum of $f_1$ on $[-1,2]$ is $f_1(2) = 18$.
$f_2'(x_2)= 2(x_2-2)(x_2+1-\frac{1}{\sqrt{2}})(x_2+1+\frac{1}{\sqrt{2}})$. Hence $f_2$ is monotonic on the intervals $(-\infty, -1-\frac{1}{\sqrt{2}}]$, $[-1-\frac{1}{\sqrt{2}},-1+\frac{1}{\sqrt{2}}]$, $[-1+\frac{1}{\sqrt{2}}, 2]$ and $[2,\infty)$. A moment's thought shows that $f_2$ is maximized at $x_2=-1+\frac{1}{\sqrt{2}}$ on the interval $[-1-\frac{1}{\sqrt{2}}, 2]$, and $f_2(-1+\frac{1}{\sqrt{2}}) = \frac{71+\sqrt{128}}{4} > 18$.
Hence the maximum distance is $\sqrt{\frac{71+\sqrt{128}}{4}}$ and it occurs at $x_1 = 2, x_2 = -1+\frac{1}{\sqrt{2}}$.
Addendum: Here is a solution to the actual problem I think the OP is trying to ask (with apologies to @Git Gud):
First, you should draw a picture.

Solve $\max_{x \in [-1,2]} |x+2-x^2|$. First note that $x+2 \geq x^2$ if and only if $x \in [-1,2]$, so the problem becomes $\max x+2-x^2$. Setting the derivative to zero gives $x=\frac{1}{2}$, hence the maximum value is $\frac{9}{4}$ which occurs at $x=\frac{1}{2}$.