Updated:

1. Teams and score (once)

/team add red "Red"
/team modify red color red
/team modify red friendlyFire false
/team add blue "Blue"
/team modify blue color blue
/team modify blue friendlyFire false
/scoreboard objectives add kills playerKillCount "Kills"
/scoreboard objectives setdisplay sidebar kills
/gamerule keep_inventory true

friendlyFire false stops teammates hurting each other. playerKillCount counts player kills automatically. keep_inventory stops kits dropping on death (use keepInventory on Java 1.21.10 and earlier and on Bedrock).

2. Split players into teams

/team join red Steve Alex
/team join blue Sam Kai

List several names to add them at once. See the team guide.

3. Team spawn points

/spawnpoint @a[team=red] 100 64 0
/spawnpoint @a[team=blue] -100 64 0

Use each team's base coordinates. Players respawn at their own base. See the spawnpoint guide.

4. Hand out kits

/clear @a[team=!]
/item replace entity @a[team=!] armor.chest with minecraft:iron_chestplate
/item replace entity @a[team=!] armor.legs with minecraft:iron_leggings
/give @a[team=!] minecraft:iron_sword
/give @a[team=!] minecraft:bow
/give @a[team=!] minecraft:arrow 32
/give @a[team=!] minecraft:cooked_beef 16

@a[team=!] means everyone on any team. Same kit for everyone keeps it fair. For stronger gear see give weapon and strongest armor.

5. Start

/scoreboard players reset @a kills
/gamemode survival @a[team=!]
/tp @a[team=red] 100 64 0
/tp @a[team=blue] -100 64 0
/title @a title {"text":"Fight!","color":"gold"}

6. Decide the winner

Put this in a repeating command block (Always Active):

/execute if entity @a[team=red,scores={kills=5..}] run title @a title {"text":"Red wins!","color":"red"}

It shows when any red player reaches 5 kills. Make a second one for blue. Turn the repeating block off once a team has won, or the title keeps showing. To use a team total, add scores up with scoreboard players operation (scoreboard minigames).

When it does not work

Check your command

The Command Error Doctor checks common syntax mistakes in your browser.