Both occur at the handling limit of a car under hard cornering.
Understeer: the front of the car loses grip and the car will not seem to be able to turn enough.
Oversteer: the rear of the car loses grip and the car fishtails or will spin around. It will turn too much.
Understeer is safer for more normal cars because it can be fixed with the brakes, and most people just hit the brakes at any sign of trouble. Oversteer offers more precise drivability but requires greater driving knowledge/skill to correct using the gas pedal with the steering wheel. Race cars are tuned more for oversteer due to the need for driving precision.
Now, these handling characteristics are all tuned into a car’s chassis but as a basic rule front wheel drive and most all wheel drive cars understeer, while rear wheel drive and a smaller percent of all wheel drive cars (sports cars) oversteer.
Top Gear’s Richard Hammond puts it best: