For gentle yoga (hatha, yin, nidra, relaxation, etc.): put comfort first to protect your knees, ankles and other joints, as well as during inverted poses (shoulderstand, plough, etc.) where you need to be gentle on the neck and spine. Use a mat between 5 and 8mm thick.
For dynamic yoga (Ashtanga, Vinyasya, Hot yoga...): these styles feature a lot of standing and balancing poses: Prioritise stability (mats between 3 and 5 mm thick) and grip.