The point of a UFD is that any element can be rewritten as a product of irreducible factors, where any other product of irreducible factors is just a rearrangement of the exact same terms, is this correct?
I.e. $f(x)=a_1a_2\cdots a_n$ where $a_i$ are irreducible for all $1\leq i \leq n$.
And if we also have $f(x)=b_1b_2\cdots b_m$ and $f(x)$ is in a UFD, we know that:
1) $m=n$, and
2) These $b_l$ are just a relabelling of the $a_i$
Is that right?
Actually, you should think in this way. UFD means the factorization is unique, that is, there is only a unique way to factor it. For example, in $\mathbb{Z}[\sqrt5]$ we have $4 =2\times 2 = (\sqrt5 -1)(\sqrt5 +1)$. Here the factorization is not unique.