When the air heats rapidly due to lightning, it quickly expands, and this sudden change in pressure and temperature creates an acoustic shock wave that we call thunder. If you are close enough to hear thunder, you are close enough to be struck by lightning. Sound dissipates over distances and becomes muddled by obstacles (trees or buildings) in its path.
Heat lightning is often associated with warm summer temperatures, however what is really being observed is lightning from a thunderstorm that is far away. Light can travel over large distances, but the thunder that accompanies the dissipates. As light from the distant storm is refracted through the atmosphere, it appears orange to distant observers
This thunder propagation schematic shows sound wave (c) travels away from the lightning bolt at certain speeds, and can encounter objects of varying height/densities (h). These obstacles can cause the sound waves to reflect in in different directions or muffle some of the sound of thunder. Image Source: Thunder Diagram | Wikimedia