An example 5K warm-up: 10-15 minutes easy running, a few dynamic drills, then 3-4 strides of 15-20 seconds building to race pace. Finish about 10 minutes before the start so you don’t cool down too much.
For the marathon, I’d just jog 5 minutes and do a couple of short strides, or even just walk around. Save the glycogen; the first kilometres at a controlled pace are the warm-up.