Spell slots are the fuel you spend to cast spells.
For now, think of cantrips as being totally separate from spells.
All spellcasters, including warlocks, have a list of spells they can cast, through some combination of knowledge and preparation (the details vary by class). These spells all have levels — comprehend languages is a first-level spell, shatter is second-level, hold monster is fifth-level, etc.
Then (PHB, p.201):
When a character casts a spell, he or she expends a slot of that spell’s level or higher.
So to cast comprehend languages, you need to "spend" at least a first-level spell slot, but to cast hold monster you need to spend a fifth-level spell slot.
Most spellcasting classes — warlocks being the exception — have different numbers of slots of different levels. For example, a 9th-level wizard has four 1st-level slots, three each of second, third and fourth-level slots, and one fifth-level slot.
Warlocks are a bit different because they have a smaller number of slots, but all of the slots are of the same level. At first level, a warlock has one first-level slot, but at 9th level they have two fifth-level slots (but no slots of any lower levels).
When you cast a spell using a slot of a higher level than the spell — for example, casting shatter (a second-level spell) using a fifth-level slot — the spell may have increased effects. Shatter does extra damage when cast using a slot higher than second level. Other spells, such as comprehend languages have the same effects regardless of the spell slot used to cast them.
Once a warlock has spent their spell slots — at ninth level, once they have cast two spells — they can't cast any more spells (again, setting aside cantrips) until they've recovered their spell slots. Most spellcasters need a long rest (eight hours) to recover spell slots, but again warlocks are different, and recover all of their slots after a short rest (one hour).
To sum up, for a warlock:
- The spells you know dictate what you can use your spell slots for.
- You don't ever "use up" a known spell.
- You spend a spell slot to cast a spell you know. After that, the spell slot is gone, but you still know the spell.
Warlocks can swap known spells as they gain levels.
From the Known Spells of 1st Level and Higher section of the Warlock class description: (PHB, p. 107):
Additionally, when you gain a level in this class, you can choose one of the warlock spells you know and replace it with another spell from the warlock spell list, which also must be of a level for which you have spell slots.
For example when a warlock goes from 3rd to 4th level, their known spells goes from four to five (per the table on p. 107 of the PHB), so that warlock can add a new known spells of first or second level, and replace one of the first or second level spells they already know with another first or second level spell. This is how most warlocks will "upgrade" low-level known spells they don't need into more useful higher-level spells.