@Balajied1999
What a challenging issue!
I am assuming your Flow is triggered by means of 'When a new email arrives'
If so, I would rather transform and merge To and CC into a single array by means of union() and split() functions, use 'Filter array' to remove XYZ@domain.com; then convert back Filter array output into a string by means of join()

I am using the following expression in 'Initialize variable'...
union(split(triggerOutputs()?['body/toRecipients'],';'),split(triggerOutputs()?['body/ccRecipients'],';'))
...also the following expression as left term of 'Filter array'...
item()
...and finally the following expression as the left term on 'Condition':
join(body('Filter_array'),';')
Hope this helps
Hope this helps