The railroad worm is a maggot of one of several fly species, characterized by their unique possession of two different colors of bioluminescence. Their body can glow green, while their head can glow red; this is due to two different kinds of luciferin and luciferase in their bodies. This is believed to be an adaptation to help confuse and frighten predators.

The adult stage lays its eggs inside fruit, typically apples. Before the arrival of apples from Europe, it typically had to rely on crabapples and hawthorns. The young "worm" that hatches consumes the fruit, and causes it to bruise and drop before ripening. It only emerges after metamorphosis into a relatively defenseless fly. At this point, its main method of defense is its appearance - its coloration is similar to that of the jumping spider.