We obtain weighted Poincare inequalities in bounded domains, where the weight is given by a symmetric nonnegative definite matrix, which can degenerate on submanifolds. Furthermore, we investigate uniqueness and nonuniqueness of solutions to degenerate elliptic and parabolic problems, where the diffusion matrix can degenerate on subsets of the boundary of the domain. Both the results are obtained by means of the distance function from the degeneracy set, which is used to construct suitable local sub- and supersolutions