Here is a modification of the example in my comment that avoids the mistake identified by Stefano. Let $Y$ be the projective cone in $\mathbb{P}^3$ over a smooth plane cubic curve $C\subset \mathbb{P}^2$. Let $\pi:X\to Y$ be the minimal desingularization. The linear projection from $Y$ to $C$ gives a regular morphism, $$\rho:X\to C,$$ that is a $\mathbb{P}^1$-bundle. The exceptional locus $E$ of $\pi$ maps isomorphically to $C$, and it is a relative hyperplane class for $\rho$. The normal sheaf $\mathcal{O}_X(\underline{E})|_E$ is isomorphic to $\mathcal{O}_{\mathbb{P}^2}(-1)|_C$.
Let $H\subset C$ be the restriction to $C$ of a hyperplane. Let $D\subset C$ be a degree $3$ effective divisor such that the divisor $H-D$ has finite order $\ell>1$ in the Picard group of $C$, i.e., $\ell H - \ell D$ is the divisor of a rational function $f$ on $C$.
Let $M\subset Y$, resp. $N \subset Y$, be the cone over $H$, resp. $D$. Denote by $\widetilde{M}\subset X$, resp. by $\widetilde{N}\subset X$, the strict transform under $\pi$ of $M$, resp. of $N$. Note that $\ell \widetilde{M}-\ell\widetilde{N}$ equals the divisor of $f\circ \rho$, as does the total pullback under $\pi$ of the Cartier divisor $\ell N-\ell M$. Thus, the coefficient of $E$ in the pullback of $M$ equals the coefficient of $E$ in the pullback of $N$.
The pullback of $M$ is the strict transform $\widetilde{M}$ plus the exceptional divisor $E$. One way to see this is to deform $M$ to a hyperplane section of $Y$ that is disjoint from the vertex of the cone. Since the intersection number of the total transform of $M$ with $E$ equals $0$, it follows that the coefficient of $E$ equals $1$.
Therefore also $\ell N$ equals the sum of $\ell \widetilde{N}$ plus $\ell E$. So, according to the definition of the pullback divisor in the comments, the pullback of $N$ equals $\widetilde{N} + E$. Yet $N$ is not Cartier on $Y$.