I have a Samsung tablet and a Samsung smartphone. Running Android 10, K9 Mail 5.734 on both.
On the smartphone, notifications didn’t work when K9 Mail wasn’t in the foreground. On the tablet (with identical config) K9 Mail worked perfectly.
Turns out to be battery saving. I guess the tablet doesn’t need to battery save that often.
The clue was (this is Samsung, so OneUI rather than stock Android) Settings, Device Care, Battery, App power management. Under “Apps that won’t be put to sleep” is shown K9 Mail. That’s good. Under “Sleeping apps” it shows K9 Mail - what ?! That’s bad.
So go to Settings, Apps, click on the tower of 3 dots, select Special access then Optimise battery usage. Switch to All, scroll down K9 Mail and turn battery optimisation off. That works.
Don’t know how different stock Android is, but hope this helps.