Let $R$ be a prime ring with extended centroid $C$, $L$ a non-central Lie ideal of $R$ and $n\geq 1$ a fixed integer. If $R$ admits the generalized derivations $H$ and $G$ such that $H(u^2)^n=G(u)^{2n}$ for all $u\in L$, then one of the following holds: {(1)} $H(x)=ax$ and $G(x)=bx$ for all $x\in R$, with $a,b\in C$ and $a^n=b^{2n}$; {(2)} char$(R)\neq 2$, $R$ satisfies $s_4$, $H(x)=ax+[p,x]$ and $G(x)=bx$ for all $x\in R$, with $b\in C$ and $a^n=b^{2n}$; {(3)} char$(R)=2$ and $R$ satisfies $s_4$. As an application we also obtain some range inclusion results of continuous generalized derivations on Banach algebras.