I am posting my comment as an answer. This already fails for relative dimension $1$ when the base scheme has dimension $n$ at least $3$.
Let $k$ be a field. Let $n\geq 3$ be an integer. Denote $\text{Proj}\ k[x_0,x_1,x_2, \dots,x_n]$ by $\mathbb{P}^n_k$. Denote $\text{Proj}\ k[y_0,y_1,y_2]$ by $\mathbb{P}^2_k$. Denote by $X$ the hypersurface in $\mathbb{P}^2_k\times_{\text{Spec}\ k}\mathbb{P}^n_k$ with bihomogeneous defining equation, $$f=x_0y_0 + x_1y_1 + x_2y_2.$$ The projection from $X$ to $\mathbb{P}^2_k$ is a Zariski-locally-trivial projective space bundle of relative dimension $n-1$. In particular, $X$ is a smooth $k$-scheme. By the Grothendieck-Lefschetz Theorem on Picard groups from SGA 2, the restriction homomorphism of Picard groups is an isomorphism, $$\text{res}:\text{Pic}(\mathbb{P}^2_k\times_{\text{Spec}\ k}\mathbb{P}^n_k) \xrightarrow{\cong} \text{Pic}(X).$$ Of course the first Picard group is $\mathbb{Z}\times \mathbb{Z}$. Moreover the nef cone in the first Picard group is $\mathbb{Z}_{\geq 0}\times \mathbb{Z}_{\geq 0}$. One way to see this is to consider restriction of ample invertible sheaves to linear rational curves ("lines") in fibers of each projection. Since the closed subscheme $X$ contains such lines as well, it follows that the restriction isomorphism also induces an isomorphism of nef cones.
In particular, the ample cone of $X$ equals $\mathbb{Z}_{>0}\times \mathbb{Z}_{>0}$, so that the non-ample nef divisors are those in the "boundary" of the nef cone, i.e., $$\{(0,0)\}\sqcup \left(\mathbb{Z}_{>0}\times \{0\}\right) \sqcup\left( \{0\}\times \mathbb{Z}_{>0}\right). $$ The invertible sheaf in the first component of this partition of the boundary is just the structure sheaf, and the associated contraction of $X$ is the constant $k$-morphism to $\text{Spec}\ k$. The second component gives the projection to $\mathbb{P}^2_k$, and the third component gives the projection to $\mathbb{P}^n_k$. Since none of these contractions is birational, it follows that $X$ is not a blowing up of some projective scheme, except as a "blowing up" that is an isomorphism.
Thus, the projection morphism from $X$ to $\mathbb{P}^n$ does not factor through a nontrivial blowing up. The restriction of this projection is flat over the closed subscheme $\text{Zero}(x_0,x_1,x_2)$, and the restriction is flat over the open complement of this closed subscheme. However, the fiber dimension over the closed subscheme is $2$, whereas the fiber dimension over the open subscheme is $1$. Thus, this projection is not a projective space bundle, although it is a projective space bundle of relative dimension $2$, resp. of relative dimension $1$, when restricted over the closed subscheme, resp. over the open subscheme.