Consider using alternate compounds or a different route that leads to the same destination.
For example, a distillation of diazomethane can be risky due to its explosive tendencies in bright light or when exposed to sharp/rough edges and scratched glassware. It is also highly toxic. Trimethylsilyldiazomethane (CAS 18107-18-1) is a convenient and safer substitute.
In the example below, the synthetic route shown at the top forms a highly explosive organic azide as an intermediate, making the experiment dangerous. The second route at the bottom proceeds through a mesylate, which has no explosive properties.

If no alternative compounds or routes are available, and you have to run an experiment that involves a potentially explosive compound, make sure you fully understand the risks and how to control them before proceeding.