A niche is defined as a specific area, where an organism lives and interacts with all the abiotic and biotic factors that affect it.
Two organisms cannot survive in the exactly same habitat as they will compete for same resources, so one will die). Hence, one of the two competing species gets evolved to use a different niche and uses different sources. This is known as resources partitioning and helps the organisms to coexist by reducing competition between them.