On the refined maximum principle for degenerate elliptic and parabolic problems