Chemical contaminants in food generally include natural toxins (mycotoxins, animal toxins, and phytotoxins), pesticides, veterinary drugs, environmental pollutants, heavy metals, and illegal additives. Developing a low-cost, simple, and rapid detection technology for harmful substances in food is urgently needed. Analytical methods based on different advanced materials have been developed into rapid detection methods for food samples. In particular, photonic crystal (PC) materials have a unique surface periodic structure, structural color, a large surface area, easy integration with photoelectronic and magnetic devices which have great advantages in the development of rapid, low-cost, and highly sensitive analytical methods. This review focuses on the PC materials in the view of their fabrication processes, functionalized recognition components for the specific recognition of hazardous substances, and applications in the separation, enrichment, and detection of chemical hazards in real samples. Suspension array based on three-dimensional PC microspheres by droplet-based microfluidic assembly is a great promising and powerful platform for food safety detection fields. For the PCs selective analysis, biological antibodies, aptamers, and molecularly imprinted polymers (MIPs) could be modified for specific recognition of target substances, particularly MIPs because of their low-cost and easy mass production. Based on these functional PCs, various toxic and hazardous substances can be selectively enriched or recognized in real samples and further quantified in combination of liquid chromatography method or optical detection methods including fluorescence, chemiluminescence, and Raman spectroscopy.