They are similar in meaning, but unjust is a stronger word than unfair . Unjust suggests that an action broke a law of some sort, whether an actual law or a moral law. Unfair suggests that an action resulted in someone receiving unequal treatment, either compared to someone else, or compared to what would be appropriate.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.