Criteria for well-posedness of degenerate elliptic and parabolic problems