I want to know what would be a better way to run 5 km if you want to lose weight. Running non-stop or taking a 10 minute break every 2.5 km, so my heart rate can go back down?
This highly depends on your current fitness and perhaps prior running experience. Unless you're overweight/obese or have very poor fitness, running for 30 minutes shouldn't be a problem. If you can walk 30 minutes, you can jog/run for 30 minutes. The catch is, however, that you might not run very fast. The only 'real' difference between walking and running is that during running, only one foot is in contact with the ground at all times. So you could even do that at walking speeds, but it won't be very comfortable.
Anyhow, taking a 10 minute break sounds like a really bad idea, unless you're in such bad shape that you really can't continue. In that case, I'd recommend seeing a doctor and getting some medical assistance. In all other cases, pick a training program that will get you in shape to run 5 km, for example C25K.
These programs make you run and walk alternatingly, so rather than taking a break, you simply start walking to catch a breath. You do these work outs 3 times a week, every week they slightly increase the duration of the running interval, while shortening the walking interval. This way you should be able to run non-stop for 5 km after about 10 weeks.
The most important factor to being able to complete this program is picking the right pace to run at. If you go too fast, you'll feel discomfort or might not even make the full running interval. So try to run at a pace where you could still hold up a conversation. This might be very slow, but that's not the point. The point is to get you in to shape so you can run in 10 weeks, not run fast right now. Also remember that if you feel discomfort while running, you can always go back to walking. Nobody is going to punish you, so don't punish yourself.
Good luck with the program and see you in 10 weeks!