First of all, thanks everyone for their extremely quick responses!
To clarify, I have attached a screenshot. It show on the right hand sides the settings for the heading style (defined as a style).
It is about two paragraph styles (heading and body). I want to avoid breaks between a heading and the subsequent body paragraph. I also need the spacing before and after (and setting it to 0 hasn't changed anything).
The "last lines" option (tried that before) does not work - and as far as I understood, this is for lines in the same paragraphs, not about subsequent paragraphs. But I might be wrong - just started using Affinity Publisher.