It’s all in the details. The difference between SEO and SEM can be boiled down to paid vs organic or ads vs optimization.
That’s simplifying it a bit too much though.
At one point in our great and varied history of search engines, SEM was an umbrella term for paid ads and organic search ranking.
So, the landscape used to look a bit like SEM with SEO and PPC underneath that. That’s changed a bit and now SEM and PPC are often used as synonyms while SEO is the organic opposite of both of those. Even Wikipedia doesn’t seem too clear on all of the semantics.