Dyes and Pigments are for the same purpose of coloring different materials but vary in the processes employed for them. Solubility plays a leading role here i.e. the tendency to disperse in a liquid especially water. It’s the same as dissolving salt in one and mud in another.
Mud when dissolved in water with all sorts of dirt and mud particles settles down. This mixture is referred to as suspension. On the other hand, when salt is dissolved in water it wholly dissolves in water. Leave it for a while and you won’t find a layer of salt particles settling at the bottom. This is called a solution. Likewise, pigments are mud that does not fully dissolve in water but get suspended. Whereas dyes are like salt that easily get dissolved in the solvent to create colourant.
Lightfastness is the tendency of fading of colourant of dyes or pigments when exposed to light. Pigments are more lightfast than dyes. Light especially sunlight damages the colour in a dyed material by splitting the open electronic bonds. Dyes are hence not much preferred as they aren’t durable and easily wither away quickly. This is partially applicable to pigments too and that’s the utmost reason why art museums have dim light to preserve the paintings.