Let R⊂A be factorial domains containing ℚ. In this paper, we give a criterion, in terms of locally nilpotent derivations, for A to be R-isomorphic to R[v,w]/(cw−h(v)), where c∈R is nonzero and h(v)∈R[v]. As a consequence, we retrieve a recent result due to Masuda [Families of hypersurfaces with noncancellation property, Proc. Amer. Math. Soc.145(4) (2017) 1439–1452] characterizing Danielewski hypersurfaces whose coordinate ring is factorial. We also apply our criterion to the study of triangularizable locally nilpotent R-derivations of the polynomial ring in two variables over R.