The simple difference is that a pigment is insoluble in waterthe liquid vehicle (water or other liquid carrier). So, when you mix it with water or another liquid, it becomes a suspension. Over time, a suspension will settle, and you'll have to mix it back up. Or, if the liquid were to evaporate, the pigment would remain.
A dye is generally soluble in waterthe liquid vehicle, or already a liquid. It doesn't settle, and if it evaporates, everything will go. Historically, dyes came from natural sources such as mashed berries, boiled plants, bugs and various vegetation.
This site contains a more scientific comparison:
https://www.duraamen.com/blog/differences-between-dyes-and-pigments/
You can also find some encyclopedic definitions on Wikipedia, which get into the way the compounds and molecules interact on a more fundamental level.