Planes at altitude are going 250 meters per second.
At 5000 meters, a typical 1millirad beam is 5 meters in diameter.
If you are hand holding your laser, the end of the beam is moving .... fast.
A 1W green laser will be equivalent to about 20 lux at 5000 meters.
Unless you are intentionally targeting a plane, your odds of randomly hitting one are pretty much 0. Even if you did, you would hit the bottom of the plane.
Where the issues occur are where planes are low to the ground as the angle is such you can illuminate the cockpit, the distances are short so the brightness is much higher, and people are targeting the plane so the exposure time is significantly higher.
If you have a 25mW green laser for star pointing, unless you live near an airport, you don't need to worry. If you have something bigger, just use common sense.
As someone pointed out, pilots cannot see the beam in the sky unless the beam is very powerful and close and the atmospheric conditions are right which usually limits distance any way.
Blue lasers are inherently more dangerous and less eye safe and unless you have a laser power meter, that 5mW could be a lot more. I have a 1W blue that looks brighter, but not that much brighter than my 50mW green. It is way way more dangerous.