8. Let $x, y$ satisfy the constraint conditions $\left\{\begin{array}{l}x-y-2 \geqslant 0, \\ x-5 \leqslant 0, \\ y+2 \geqslant 0 .\end{array}\right.$ Then the sum of the minimum and maximum values of $z=x^{2}+y^{2}$ is $\qquad$
8. 36 .

The feasible region is formed by the constraint conditions, as shown in Figure 1, which is the interior and boundary of $\triangle ABC$, where $A(5, 3)$, $B(5, -2)$, and $C(0, -2)$.

Notice that the geometric meaning of $x^{2} + y^{2}$ is the square of the distance from point $P(x, y)$ to the origin. Therefore, the maximum value of $x^{2} + y^{2}$ is
$$
A O^{2} = 25 + 9 = 34 \text{.}
$$

The minimum value of $x^{2} + y^{2}$ is the square of the distance from the origin to the line $x - y - 2 = 0$, which is
$$
P O^{2} = \left(\frac{2}{\sqrt{2}}\right)^{2} = 2 \text{.}
$$

Thus, the required value is $34 + 2 = 36$.