I'm trying to prove that if $\pi : V \to W$ is a flat familiy between affine algebraic varieties, with $V$ irreducible and $W$ of pure dimension, then
$$\dim V_q = \dim V-\dim W$$
for any non-empty fiber $\pi^{-1}(q) =: V_q$.
The fiber dimension theorem gives $(\geq)$, so it suffices to show $(\leq)$. The reference I am following proves that if $f: A \to B$ is a flat morphism and $\mathfrak{q}$ is a prime laying over $\mathfrak{p}$ then
$$\dim B_\mathfrak{q}/\mathfrak{p}B_\mathfrak{q} \leq \dim B_\mathfrak{q}- \dim A_\mathfrak{p}.$$
Applying this to $F^{\ast} : k[W] \to k[V]$ and $\mathfrak{M}_q$ the ideal associated with $q \in W$, we have an inequality on local dimensions,
$$ \dim (V_q,p) \leq \dim (V,p) - \dim (W,q) $$
where $p \in V_q$.
This is supposed to imply that $\dim V_q \leq \dim V - \dim W$, but I am not seeing how. Can you give me any hints?
Taking supremum on $p$ we can see that $\dim V_q \leq \dim V - \dim (W,q)$, but I couldn't get further.
This is a community-wiki answer recapping the discussion from the comments which resolved the question.
The problem assumes that $V$ is irreducible and $W$ is pure-dimensional. This means that $\dim(V,p)=\dim V$ and $\dim(W,q)=\dim W$ for any $p\in V$ and any $q\in W$. (The fact we're working on varieties, aka schemes of finite type over a field, is crucial here - it's not true without that assumption.)
Your statement that you followed up with about $\dim(V,p)\leq \dim V$ is correct: the RHS is the supremum of the LHS (more or less by definition).