You can play PlayStation 4 games on a PlayStation 5 because the PlayStation 5 is backward compatible with the PlayStation 4.
You can play PS3 and PS2 games on your PS4 or PC by signing up for PlayStation Now, Sony's game streaming service.