For non-smooth $Z$ the answer is in general **no**.

Take $P=\mathbb{P}^4$ and let $Z \subset \mathbb P^4$ be a surface with a non-normal double point $p$ (i.e. a singularity locally analytically isomorphic to the one given by two planes intersecting in a single point, it is no difficult to construct irreducible examples, for instance taking general projections from smooth surfaces in $\mathbb{P}^5$).

Then there is no smooth hypersurface $H$ containing $Z$, since the singularity $p$ has embedding dimension $4$.

**Added.** Here is another counterexample, showing that the answer is in general **no** even if $Z$ smooth.

Let $P=\mathbb{P}^4$ and $Z \subset \mathbb{P}^4$ be a smooth surface which is not a complete intersection (for instance, an abelian surface). If $H$ is any hypersurface containing $X$, by the Lefschetz hyperplane theorem the induced restriction map between Picard groups $$\textrm{Pic} \, \mathbb{P}^4 \longrightarrow \ \textrm{Pic} \, H$$ is an isomorphism. Then, if $X$ were a Cartier divisor in $H$, it would be a complete intersection there, hence a complete intersection in $\mathbb{P}^4$, contradiction.

This shows that $Z$ is not a Cartier divisor inside $H$, hence $H$ is necessarily singular at some point of $Z$.