When a player switching from any gamemode to spectator mode whilst attracting xp, the xp will stay being attracted unless moving far away.
This does not happen in 1.21.4
Steps to Reproduce:
Throw bottle o' enchanting on the ground
Go near it
Switch to spectator mode before you pick it up (Use f3+n or f3+f4 quickly)
❌ The Xp follows you
I am able to reproduce the reported behavior. It was introduced in 25w02a, presumably alongside the fix of MC-278249.