Distillation is based on understanding the different boiling or vaporization temperatures of the various components of cannabis and hemp extracts.
For example, THC boils at 155°C and therefore vaporizes before CBD, which boils at 165°C. Most terpenes vaporize at lower temperatures, while most minor cannabinoids boil at higher temperatures. Fats and waxes and other undesirable compounds still boil at higher temperatures, but these temperatures can also produce undesirable compounds like benzene.
To prevent this, CBD distillation is performed under high vacuum, which allows the use of much lower temperatures - from 0°C to 100°C - that do not cause combustion or other toxic chemical processes.