The assumptions which all carry about fireflies and glow warms that fireflies can fly and glow warms are warms is usually wrong. In fact, fireflies are not flies and glow warms are not actually warmed. Fireflies belong to the family Lampyridae and are soft-bodied beetles whereas glow is actually young larvae i.e. fireflies.
Most organisms which are able to imitate light are due to the action of enzymes which is called luciferase. Although, this type of molecule that is able to produce light is yet too underdetermined in many organisms.
Some organisms make use of calcium-activated photoproteins in their light producing reaction instead of using luciferase. Fireflies in order to emit light make use of special cells called photocytes which is present on their lower abdomen to attract mates. It is assumed that male fireflies make some kind of flashing pattern in order to give signals to female fireflies while female fireflies prefer males which flash light rapidly.
No one knows the reason why glow warms glows because they do not mate. One reason can be that glow warms are carnivores and they may glow in order to locate their prey.
In tropical and temperate regions there are about 2000 species of fireflies. Moreover, fireflies of the same species recognize each other. It is also noticed that the eggs of fireflies glow.
So, the reason that fireflies are able to glow is that they are able to mate while glow warms do not mate but still uses the light to locate their prey.