execute if entity @s[nbt={Item:{id:"minecraft:sunflower",components:{"minecraft:custom_data":{blue:1b}}}}] run team join blue
execute if entity @s[nbt={Item:{id:"minecraft:sunflower",components:{"minecraft:custom_data":{red:1b}}}}] run team join red
data merge entity @s {Glowing:1b}
tag @s add team