Is there any non-UFD that is a commutative ring such that $a^2 \mid b^2$ does not always lead to $a\mid b$?
It would be preferable if examples are something that does not involve monomials/polynomials, and there are some integer parts in the non-UFD (for example, gaussian integers have integer parts, though gaussian integer is UFD).