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 damage can be particularly severe if the power draw is spiking, as when the Enterprise extended it's shields to protect a crippled freighter from asteroid collisions. Such damage can cause the crystals to "burn out" and become unusable.
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. The orientation of crystals in the warp core affects the efficiency of the matter-antimatter reaction, determining the maximum rate at which reactants can be fed into the warp core.
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.