Dimension of affine variety mod $p$ can only increase Let $X$ be an affine variety defined by polynomials over $\mathbb{Z}$.
Reducing the polynomials modulo $p$, we obtain a variety $X_p$ defined over the finite field $\mathbb{F}_p$.

Is it true that the dimension of $X_p$ is larger or equal to the dimension of $X$?

Note: It seems likely to me that the dimension stays the same for all but finitely many primes $p$, and this answers says that it is the case for projective varieties. My question is different: I'm asking about affine varieties, I'm asking about all primes, and I'm only asking for an inequality.
EDIT: To make the second part of the question explicit:

In addition, is it also true that $\dim X_p=\dim X$ for all but finitely many primes $p$?


Let me state the following result (Lemma 05F7 in the Stacks Project):

Let $f:X\rightarrow S$ be a morphism of finite type where $S$ is an
irreducible scheme (with generic point $\eta$). If $n=\mathrm{dim}X_\eta$
then there exists a nonempty open $U\subseteq S$ such that for
all $s\in U$ one has $\mathrm{dim} X_s=n$.

Hence, whenever you have a variety $X$ over $\mathbf{Z}$ (which means a $\mathrm{Spec}(\mathbf{Z})$-scheme of finite type), the dimension of $X\otimes_\mathbf{Z} \mathbf{F}_p$ (the fiber over $(p)$) is equal to that of $X\otimes_\mathbf{Z}\mathbf{Q}$ (the fiber over the generic point of $\mathrm{Spec}(\mathbf{Z})$) for all but finitely many primes $p$.
Finally, your question amounts to knowing if $\mathrm{dim}X\leq\mathrm{dim}(X\otimes_\mathbf{Z}\mathbf{Q})$, but this is not always true: consider $X=\mathrm{Spec}(\mathbf{Z}\left[ X\right] /(2))=\mathrm{Spec}(\mathbf{F}_2\left[ X\right] )$ so that $\mathrm{dim}(X)=1$ while $\mathrm{dim}(X\otimes_\mathbf{Z}\mathbf{Q})=-\infty$.
