A habitat is the physical location where an organism lives, whereas a niche refers to the specific role and interactions of an organism within its habitat, including its feeding habits, reproductive behavior, and interactions with other species.