For rogues using cunning action to hide, I've been ruling that after the first attack with advantage due to being hidden, creatures get advantage on their perception checks unless the rogue hides in a such a way that they
could attack from at least three different places (or, for grid mechanics, the target making a perception check needs to have lost the rogue in an area that covers 15'. Small rogues moving behind the legs of their companions, any rogue ducking behind a couple of trees or around a corner... the point is, the target knows that they have lost track of the rogue. However, they know where the rogue
was. If there's only one 5' space the rogue could pop out from, it's much easier to detect them as they pop out. If the target has to scan several places
and keep track of everyone else on the battlefield, it's believable that the rogue can pop out and make a (ranged) attack before being spotted (making a melee attack would, as usual, require getting within 5' of the target without being detected, which there are rules for already).
This seems to be a lot easier to explain at the table than to type - the above looks overcomplicated. If I recall correctly, I've just been saying to the rogue players "Make sure you
could attack from anywhere in a 15' area and don't behave predictably and I'll give you a standard perception check. Otherwise the enemy gets advantage after the first time".
Of course, with creatures of INT 3 or lower, I assume they don't have object permanence and simply allow any successful hide check to work