Random 999 ping issue

Randomly get 999 ping. It’s below 100 80% of the time, but sometimes spikes to 999 and then the game is unplayable. The internet works perfectly. I can watch a youtube video while this is happening, and it loads perfectly. It comes and goes at random, although it is worse immediately after I die and after I respawn, but it can happen at any time. Game ruiner, it frequently leads to deaths. Is there anything I can do about it? Packet loss is not bad, only up to 20% during these events.