The bug
The darkness effect fades out while there is still 5 seconds left on the timer, even though the effect should still be active. This makes the following command useless:
/effect give @s minecraft:darkness 5
It's also worth noting that for those 5 seconds, the fog in the far distance created by the darkness effect remains.
Fixed in 22w18a, fwiw.