\(y'=\left(x-2\right)^2+2\left(x+1\right)\left(x-2\right)=0\Rightarrow\left[{}\begin{matrix}x=0\Rightarrow y=4\\x=2\Rightarrow y=0\end{matrix}\right.\)
\(\Rightarrow A\left(0;4\right)\) ; \(B\left(2;0\right)\)
\(\Rightarrow\overrightarrow{AB}=\left(2;-4\right)\Rightarrow AB=\sqrt{2^2+\left(-4\right)^2}=2\sqrt{5}\)