Dilithium is a crystalline substance used to regulate matter-antimatter reactions in Star Trek warp cores. Dilithium is a natural material typically mined from planets. It is apparently impossible to replicate, but decaying crystals can be made to "restructure" themselves via exposure to photons captured from a nuclear fission reaction.
Dilithium crystals degrade over time in an operating warp core, particularly if the warp core runs at high output for an extended period of time. The orientation of crystals in the warp core affects the efficiency of the matter-antimatter reaction and can allow the warp core to accept reactants at a greater rate.
Dilithium is supposed to be carefully shaped and positioned within a warp core to provide an efficient reaction, but unworked or broken crystals can be installed in an emergency to get the warp drive working.
While dilithium is evidently non-toxic, it can pose a risk under the right circumstances. The planet Drema IV had "the largest deposit of dilithium ore ever recorded", and the crystals were "growing to form perfectly aligned lattices". This crystal growth converted heat from the planet's mantle into mechanical energy in the tectonic plates, resulting in severe earthquakes.