Let $R$ be a UFD, and let $a$ and $b$ be nonzero nonunit elements of $R$. Since it's a UFD, each nonzero nonunit element determines a factorization into irreducbles, though possibly not unique(but if for each two such $q_1...q_k$, $p_1...p_r$ we have $k = r$ and $(q_i) = (p_i)$(after reordering, if needed).
What I need to prove if $a| b$, then one factorization of $b$ is contained in one factorization of $a$.
We have
$b = ac$. If $u$ is a unit, we cannot factorize it, but we know that $qu$ is also a unit for an irreducble $q$(easy to prove, the key fact is that $(uq) = (q)$). Okay, if $u$ is a unit, then let $q_1...q_k$ be a factorization of $b$, and $p_1...p_r$ be a factorization of $a$. Then we have $q_1...q_k = (up_1)...p_r$. And it follows that $k = r$ and (after reordering, if needed) $q_1 = up_1$ and for $2 \leq i \leq k \ \ (q_i) = (p_i)$
What can be done next? The problem is that $x_1...x_n = y_1...y_m$ in a UFD imples that $m = n$ and $(x_i) = (y_i)$, but not vice versa: $m = n$ and $(x_i) = (y_i)$ doesn't always imply that $x_1...x_n = y_1...y_m$.
So, how do we find out that a factorization of $b$ is contained in a factorization of $a$?
Ok. You have that $b=ac$.
You've more-or-less thought about the case when $c$ is a unit. If so, $b=ac=p_1\cdots p_r \, c$ so $p_1,\dots,p_{r-1},cp_r$ are irreducible factors of $b$. Thus they must match the other factorization of $b$ (i.e. $b=q_1\cdots q_k$) up to order and associates. [Among other things, this implies that $r=k$.] In any case, by the definition of "up to order and associates" $a$'s factorization is contained in $b$'s (because they're essentially the same).
Now if $c$ isn't a unit, it's definitely not zero (otherwise $b=ac=a0=0$). So how do you proceed? You should factor $a$ and $c$. Say $c=s_1\dots s_t$ where $s_1,\dots,s_t$ are irreducibles. But this means that $b=ac$ has a factorization: $p_1\dots p_r \cdot s_1 \cdots s_t$. This must match $b$'s other factorization. Thus each $p_i$ and $s_j$ term is an associate of some $q_n$. This means that the $p$'s are contained among the $q$'s (up to associates).
Edit: Uniqueness up to order and associates means that given two factorization, both must have the same number of irreducible factors. In addition, if $p$ appears as a factor in one factorization, then the other factorization must have a corresponding factor $q$ where $p$ and $q$ differ by a unit.
Since $b=p_1\dots p_r \cdot s_1 \cdots s_t= q_1\cdots q_k $ each $p_j$ must correspond to some $q_n$. Not that $p_j=q_n$, but $p_j=uq_n$ for some unit $u$. In this way the p's are "contained" in the list of q's...well...not exactly, but contained up to differing by units (i.e. up to associates).
Edit 2: Here's a specific example...
6 divides 24 because 6×4=24.
We can factor 24 as 24 = (-2)(2)(-2)(3). It's weird to pick negative factors. We usually pick positive factors. However in a general UFD, there is no concept of "positive" and generally no way to make a uniform selection of irreducible factors.
Anyway, back to factoring, we have 6 = (-2)(-3) and 4 = (-2)(-2).
24 = (-2)(2)(-2)(3) = (-2)(-3)(-2)(-2)
We can see that the factors of 6: -2 and -3 appear in the list of factors of 24: -2, 2, -2, and 3....well not exactly. -2 does appear but -3 appears "up to an associate" (namely its associate 3).