With your grep pipeline, any line in TextFile containing the string string1 will be treated by xargs as the name of a file to be passed as an operand to sed . I fail to see how that would meet your ambiguous requirements no matter how I try to guess at what you mean.
And, since you haven't told us what operating system and shell you're using, we have no way of knowing whether or not the non-standard sed -i option is supported on your system.
If sed on your system does have a -i option and what you want to do is replace every occurrence of the string string2 with the string string3 on every line that contains the string string1 and leave lines that do not contain the string string1 unchanged, the obvious way to do what you want is:
sed -i '/string1/s/string2/string3/g' TextFile
and a safer, portable way to do that would be to use:
keyword and . are not just strings, they are regular expressions. And the regular expression . matches any single character. And globally replacing every character in a line with an empty string changes every line that contains keyword into an empty line.