On-site drug testing using easily accessible body fluids, such as saliva, has gained a lot of importance both for road safety and forensic applications. However, saliva is a complex, inhomogeneous amalgam with many different compounds, whose concentrations change between people and over time. This leads to a wide range of fluid properties, e.g., viscosity, surface tension, making saliva pretreatment in microfluidic systems extremely challenging. We present the development, fabrication and characterization of a low-cost, portable microsystem to detect cocaine in human saliva. The chip combines multiphase liquid-liquid extraction to transfer the cocaine from the infrared (IR) light absorbing saliva to the IR-transparent solvent, perchloroethylene (PCE), together with on-chip cocaine detection by IR-spectroscopy (IR-laser, waveguide, detector). This miniaturized sensing platform has been developed as part of the Nano-Tera project IrSens. Saliva is a suitable matrix for the analysis of small molecules such as cocaine, but it is found to be a challenge to process this complex fluid on a microfluidic chip due to the risk of clogging. The characterization of the rheological behavior of saliva is described and then a suitable sample pretreatment method is presented. The low-cost UV-curable polymer NOA81 was chosen as microfluidic chip material and characterized for microfluidic applications. For research applications a new, highly flexible, and low-cost NOA81 rapid prototyping method is presented based on scotch-tape masters. Furthermore, this thesis introduces a microfluidic chip design combining a simple and robust droplet generation method together with a geometry for droplet merging in order to perform continuous droplet-based liquid-liquid extraction. The extraction efficiency of the system was evaluated by state-of-the-art mass spectrometry measurements. The microfluidic chip has been integrated in an optofluidic microsystem transferring cocaine from human saliva to the IR-transparent organic solvent PCE and thereby enabling cocaine detection by IR-spectroscopy. In this thesis we achieved to develop a simple and robust droplet generation method re- sulting in precise and controlled droplet sizes, and which allowed to process complex fluids such as human saliva without clogging. Furthermore, a droplet-based liquid-liquid extraction system which transfers the cocaine continuously from human saliva to the organic solvent PCE was established. For these liquids the developed system yielded a two to three times higher extraction efficiency than state-of-the-art devices. In addition, we demonstrated that our system has the potential for cocaine preconcentration in PCE, which is crucial for IR spectroscopy, our final application.