Prosopagnosia
From ActuallyAutistic Wiki
I think this can be worded better
Congenital Prosopagnosia, often just shortened to prosopagnosia, is also known as "face blindness". It is a difficulty recognizing faces. In the severest form, the person may not recognize their own face.
Some people can recognize others in certain situations but not when encountered outside of this context. An example would be not recognizing your teacher outside of school.
There is also a phenomenon sometimes referred to as "cross-race effect" where people are able to tell those in their own race apart more easily than other races. This is different from prosopagnosia because face blindness includes your own race.