“While” can be used in many different ways.
“Whereas” and “while” are similar in phrases like these:
“Hannah was very happy, whereas katie was quite upset”
“Hannah was very happy, while Katie was quite upset”
They are different because “while” can be used like this:
“While he liked pizza, he liked tacos more.”
“He ate his food while watching tv.”
“He was in the store for a while.”