The fact that sound travels nearly a million times slower than light in air allows us to estimate distances to the lightning. If you count from when you see the lightning flash until you hear the thunder, each second equals around 340 m in distance (since sound moves at around 340 m/s in air).
e.g. Jennifer is out walking her dog. She sees a flash of lightning and counts 5 seconds until the thunder is heard. How far away is the storm?
speed = distance / time
The lightning struck 1.7 km away.
Of course, if the thunder and lightning is very close by, the time delay is too small to notice.