We report a sensitive and versatile biosensing approach, LUCID (luminescence compact in vitro diagnostics), for quantitative molecular and cellular analyses. LUCID uses upconversion nanoparticles (UCNPs) as luminescent reporters in mutually exclusive photoexcitation and read-out sequences implemented on a smartphone. The strategy improves imaging signal-to-noise ratios, eliminating interference from excitation sources and minimizing autofluorescence, and thus enables filterless imaging. Here we developed a miniaturized detection system and optimized UCNPs for the system and biological applications. Nanoparticle luminescence lifetime was extended by controlling particle structure and composition. When tested with a range of biological targets, LUCID achieved high detection sensitivity (0.5 pM for protein and 0.1 pM for nucleic acids), differentiated bacterial samples, and allowed profiling of cells. In proof-of-concept clinical use, LUCID demonstrated effective screening of cancer cells in cervical brushing specimens, identifying patients at high risk for malignancy. These results suggest that LUCID could serve as a broadly applicable and inexpensive diagnostic platform.