You are not alone with this...
Most of my apps that I allow notifications are fine, however, I have one that drives me crazy. I use a "Meross Smart WiFi Garage Door Opener", the device works perfectly and sends a notification to the phone on open or close. If I have just been using the phone or am using the phone the notification comes in instantly, but if I haven't been using the phone recently it can take up to 30 minutes tho get the notification, unless I open the phone, then it will come through...
I have gone through settings after settings and nothing makes any difference. I have shut off battery optimization totally on the phone, and nothing, put no apps to sleep, and no change. I don't know where else to look.