Pigment is what provides the colour in dyes- it's what gets into or onto the material to change its colour. Pigments that are used to colour textiles or food are called dyestuffs, pigments used for writing are inks, and pigments used for painting are paints or just pigments.
Dyestuffs tend to be solids that are soaked in water to extract them, and then fibres are added which soak up the water soluble dye. A mordant is added as a setting agent to make the dye stick to the fibre.
Paints tend to require more opacity than dyes. The same ingredient as a dyestuff may be used, but fine sawdust or other filler agents (e.g. rag scrapings) are added to give the dye bulk. This pigment is intended to mostly sit on the surface of the object, not soak through it. Some pigments are available for use as paints that cannot be used for dyestuffs (e.g. ground lapis lazuli). These pigments do not have water soluble colour, they only need to be ground fine enough to be able to be picked up with a paintbrush.