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 belongs 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 action of enzymes which is called luciferases. 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 photo proteins in their light-producing reaction instead of using luciferases. 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 flashes 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 recognise each other. It is also noticed that the eggs of fireflies glow.
So, the reason that fireflies are able to glow is because they are able to mate while glow warms do not mate but still uses the light to locate their prey.