I know that the factorization of a nontrivial ideal into prime ideals is unique in a Dedekind domain. Not all UFDs are Dedekind domains, so there must be a UFD in which there exists a nonzero ideal with non-unique factorization into prime ideals.
In non-Dedekind UFD $\mathbb{Z}[x]$, the ideal $(2, x)$ is not principal, but it has unique factorization. So this attempt fails.
Would you please provide an example of a UFD in which the unique factorization of a nonzero ideal into prime ideals is not possible?
If you knew that in a Dedekind domain UFD and PID are equivalent, would you be able to come up with an example yourself?
Unique factorization domain that is not a Principal ideal domain