This is an example from a flow I created to do the same thing some time ago. This expression eliminates the IF statement in your flow as puts it in just the owner field.
the only difference I see is to remove the starting forward slash “/“ - so simply “teams(guid)”
if(
equals(
items('Apply_to_each')?['_xx_lookup_value@Microsoft.Dynamics.CRM.lookuplogicalname'],
'systemuser'),
concat('systemusers(', items('Apply_to_each')?['_xx_lookup_value'] , ')'),
concat('teams(', items('Apply_to_each')?['_xx_lookup_value'] , ')')
)