Let A be a unital semiprime, complex normed ∗-algebra and let f, g, h : A → A be linear mappings such that f and g+h are continuous. Under certain conditions, we prove that if f(p ◦ p) = g(p) ◦ p + p ◦ h(p) holds for any projection p of A, then f and g+h are two-sided generalized derivations, where a◦b = ab+ba. We present some consequences of this result. Moreover, we show that if A is a semiprime algebra with the unit element e and n > 1 is an integer such that the linear mappings f, g : A → A satisfy f(x n ) = Pn j=1 x n−j g(x)x j−1 for all x ∈ A and further g(e) ∈ Z(A), then f and g are two-sided generalized derivations associated with the same derivation. Also, we show that if A is a unital, semiprime Banach algebra and F, G: A → A are linear mappings satisfying F(b) = −bG(b −1 )b for all invertible elements b ∈ A, then F and G are two-sided generalized derivations. Some other related results are also discussed.