3 Didn't see t he condition $Z_y\ne X_y$ !

In fact both sets are constructible in $Y$.

Suppose for simplicity that $X$ is connected. Then the dimension of the (non-empty) fibers of $X\to Y$ is constant (EGA IV.12.1.1(i), and flatness is enough), denote it by $d$. Let $Y'$ be the (integral) image of $Z$ in $Y$. We can replace $X\to Y$ by $X\times_Y Y'\to Y'$ and suppose that $Z\to Y$ is surjective. Let $e$ be the dimension of the generic fiber of $Z\to Y$.

Special case: $e=d-1$. By Chevalley's theorem (EGA IV.13.1.1), for any $y\in Y$, the irreducible components of $Z_y$ all have dimension $\ge d-1$. By hypothesis, and the set $Y_d$ of $y\in Y$ such that Z_y\ne X_y$, hence$\dim Z_y\ge d$is closed in$Y$(EGA IV.13.1.5)Z_y\le d-1$. Therefore $\mathrm{Pic}_\pi(Z) = Y \setminus Y_d$ is open in $Y$ (and locally it is closed in $Y$ if $Z$ doesn't dominate $Y$). It is not closed in general.

Example. Let $Y=\mathrm{Spec}\mathbb C[x,y]$, let $X=\mathbb P^1_Y$ with homogeneous coordinates $u,v$. Let $Z$ be the hypersurface in $X$ defined by $xu+yv=0$. Then $\mathrm{Pic}_\pi(Z)$ is the complementary of the origin. To get a codimension $2$ example, add an extra variable $w$ to $Y$, $X$ is still the projective line and add the equation $w=0$ to $Z$.

General case. The set of $x\in Z$ such that $\dim_x Z_{\pi(x)}\ne d-1$ Z_{\pi(x)}\le d-2$is constructible open in$X$Z$ (EGA IV.13.1.3). The complementary of the image by $\pi$ of this constructible open subset is constructible and is your $\mathrm{Pic}_\pi(Z)$.

Note that in {Pic}_{\pi}(Z)$. In case$Z\to Y$is flatand surjective, the then$\mathrm{Pic}_\pi(Z)$is empty or is equal to closed by openess of$Y$. \pi|_Z$.

For the second question, if $F$ denotes the set of $x\in Z$ such that all associated components of $Z_{\pi(x)}$ passing through $x$ have dimension $\ge d-1$, then you are considering $\pi(X\setminus F)$. By EGA, IV.9.9.2(iii), $F$ is constructible, so your set is constructible.

If $Z\to Y$ is moreover flat, then $F$ is open by EGA, IV.12.1.1(i) (I learn recently this reference from an anonymous referee.), hence your set $\pi(X\setminus F)$ is in fact closed.

2 misread par of the second question.

In fact both sets are constructible in $Y$.

Suppose for simplicity that $X$ is connected. Then the dimension of the (non-empty) fibers of $X\to Y$ is constant (EGA IV.12.1.1(i), and flatness is enough), denote it by $d$. Let $Y'$ be the (integral) image of $Z$ in $Y$. We can replace $X\to Y$ by $X\times_Y Y'\to Y'$ and suppose that $Z\to Y$ is surjective. Let $e$ be the dimension of the generic fiber of $Z\to Y$.

Special case: $e=d-1$. By Chevalley's theorem (EGA IV.13.1.1), for any $y\in Y$, the irreducible components of $Z_y$ all have dimension $\ge d-1$, and the set $Y_d$ of $y\in Y$ such that $\dim Z_y\ge d$ is closed in $Y$ (EGA IV.13.1.5). Therefore $\mathrm{Pic}_\pi(Z) = Y \setminus Y_d$ is open in $Y$ (and locally closed in $Y$ if $Z$ doesn't dominate $Y$). It is not closed in general.

Example. Let $Y=\mathrm{Spec}\mathbb C[x,y]$, let $X=\mathbb P^1_Y$ with homogeneous coordinates $u,v$. Let $Z$ be the hypersurface in $X$ defined by $xu+yv=0$. Then $\mathrm{Pic}_\pi(Z)$ is the complementary of the origin. To get a codimension $2$ example, add an extra variable $w$ to $Y$, $X$ is still the projective line and add the equation $w=0$ to $Z$.

General case. The set of $x\in Z$ such that $\dim_x Z_{\pi(x)}\ne d-1$ is constructible in $X$ (EGA IV.13.1.3). The complementary of the image by $\pi$ of this constructible subset is constructible and is your $\mathrm{Pic}_\pi(Z)$.

Note that in case $Z\to Y$ is flat and surjective, the $\mathrm{Pic}_\pi(Z)$ is empty or is equal to $Y$.

For the second question, if $F$ denots denotes the set of $x\in Z$ such that the all associated components of $Z_{\pi(x)}$ passing through $x$ have dimension $\le d-2$\ge d-1$, then you are considering the complementary in$Y$of$\pi(X\setminus F)$. By EGA, IV.9.9.2(iii),$Z$F$ is constructible, so your set is constructible.

If $Z\to Y$ is moreover flat, then your set $F$ is indeed open by EGA, IV.12.2.1(i). (This is an immediate consequence of IV.12.1.1(i) which (I learn recently this reference from an anonymous referee.)referee.), hence your set $\pi(X\setminus F)$ is in fact closed.

1

In fact both sets are constructible in $Y$.

Suppose for simplicity that $X$ is connected. Then the dimension of the (non-empty) fibers of $X\to Y$ is constant (EGA IV.12.1.1(i), and flatness is enough), denote it by $d$. Let $Y'$ be the (integral) image of $Z$ in $Y$. We can replace $X\to Y$ by $X\times_Y Y'\to Y'$ and suppose that $Z\to Y$ is surjective. Let $e$ be the dimension of the generic fiber of $Z\to Y$.

Special case: $e=d-1$. By Chevalley's theorem (EGA IV.13.1.1), for any $y\in Y$, the irreducible components of $Z_y$ all have dimension $\ge d-1$, and the set $Y_d$ of $y\in Y$ such that $\dim Z_y\ge d$ is closed in $Y$ (EGA IV.13.1.5). Therefore $\mathrm{Pic}_\pi(Z) = Y \setminus Y_d$ is open in $Y$ (and locally closed in $Y$ if $Z$ doesn't dominate $Y$). It is not closed in general.

Example. Let $Y=\mathrm{Spec}\mathbb C[x,y]$, let $X=\mathbb P^1_Y$ with homogeneous coordinates $u,v$. Let $Z$ be the hypersurface in $X$ defined by $xu+yv=0$. Then $\mathrm{Pic}_\pi(Z)$ is the complementary of the origin. To get a codimension $2$ example, add an extra variable $w$ to $Y$, $X$ is still the projective line and add the equation $w=0$ to $Z$.

General case. The set of $x\in Z$ such that $\dim_x Z_{\pi(x)}\ne d-1$ is constructible in $X$ (EGA IV.13.1.3). The complementary of the image by $\pi$ of this constructible subset is constructible and is your $\mathrm{Pic}_\pi(Z)$.

Note that in case $Z\to Y$ is flat and surjective, the $\mathrm{Pic}_\pi(Z)$ is empty or is equal to $Y$.

For the second question, if $F$ denots the set $x\in Z$ such that the associated components of $Z_{\pi(x)}$ passing through $x$ have dimension $\le d-2$, then you are considering the complementary in $Y$ of $\pi(X\setminus F)$. By EGA, IV.9.9.2(iii), $Z$ is constructible, so your set is constructible.

If $Z\to Y$ is moreover flat, then your set is indeed open by EGA, IV.12.2.1(i). (This is an immediate consequence of IV.12.1.1(i) which I learn recently from an anonymous referee.)