I think an easier way to understand is to make an analogy with the product. Imagine that an ID works like a serial number, in other words, it must be unique, so you can identify a product with a million equal copies.
Then, imagine that class as a Product Code can be a barcode, for example. In the supermarket, all the same products have the same barcode that is read by the optical reader.
Thus, the ID is a unique identifier, and the class groups a group of elements.
But if I use the same ID in my HTML / CSS, I get a great result, why should I worry about unique s ID ?
Reason number 1:
In the future, if you need to use Javascript, and if you need to manipulate a specific element and it has a duplicate ID , your code will not generate the expected result.
Reason number 2
Your code will not be rated by W3C, which means you may have headaches with the compatibility of your website compared to browsers. It can work fine in one browser, but not in another.
Using a real-life example, imagine that you want to dynamically update, using Javascript, the text of this element:
<blockquote id="exampleID1"> Here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation. </blockquote>
With Javascript / JQuery you will use code like this:
$("#exampleID1").html("Changing element content");
And then the text of the <blockquote id="exampleID1"> element will be updated, but this element will also be updated because it has the same ID .
<p id="exampleID1">This paragraph has an ID name of "exampleID1" and has a blue CSS defined background.</p>
So, if you want to update only one item, they must have a unique ID s.
Hope you can use this explanation to better understand the difference between an ID and a class .