If there are 3 or more players, the scoreboard objective "custom.playerkills" and the advancement trigger "player killed entity" will give the kill to the first player to hit an entity, rather than the player that actually kills it.
Example:
Player A hits Player B
Player C kills Player B
Player A gets the kill on Player B
Both the advancement and the objective will trigger/add for Player A in this scenario.
Linked issues
Comments 2

Thank you for your report!
We're tracking this issue in MC-260903, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
Duplicate of MC-260903.