Modern automatic firearms, alongside modern semi-automatic pistols and explosive devices like grenades, render bayonets - and importantly other melee weapons like swords - largely irrelevant. If you get stuck in melee you just shoot the opponent. The range at which a bayonet, or just clubbing with the butt of a rifle, retains utility is also a range at which you have sufficient mobility to just shoot the enemy. That's different from knife/grapple range, in which case you just want a knife.

Most modern (and really anything dating from 1900 onward) bayonets are actually just full on knives with handles and all that have attachment points to fit on a rifle and just look like big buck knives to an untrained observer, such as the M9 Bayonet currently in use by the US army. Soldiers carrying these only affix them to their weapons very rarely, in the extremely unusual circumstance where you need something like a spear. Grimly, the most common use is actually probably to walk through a battlefield and stab the wounded, since an affixed bayonet allows this to be done without having to bend down.

Rather than bayonets, the presence of teleporting demons would probably result in a switch to highly effective close range firearms, so submachine guns and shotguns rather than assault rifles. A modern submachine gun like the FN P90 can empty an entire 50-round magazine in something like 3 seconds. A demon teleporting into melee range is asking to take a massive face full of bullets/buckshot from nearby soldiers.

The only, only reason for anyone with anything like modern firearms to switch back to a melee based combat approach (please note that entertainment media drastically exaggerates the propensity of melee encounters in combat for dramatic effect, melee wounds have been a fraction of a percent of all combat injuries since at least the American Civil War) is if ranged weapons are incapable of harming the foe. In the case of something like demons this would probably be due to DR, though low-grade DR could probably be overcome by switching to high-powered 'armor-piercing' ammo like shotgun slugs (watch John Wick 3 for an example).