Molecular sieves work by utilizing their uniform pore structures to differentiate between molecules of different sizes. When a mixture of molecules is introduced, only those that are smaller than the pore size can enter and be adsorbed. This unique characteristic is primarily due to the crystalline structure of materials like zeolites and metal-organic frameworks (MOFs).