On some extremal problems for analytic functions with constraints on real or imaginary parts