To negate a range in a regular expression, the caret must be inside the square brackets.
sed -i -r 's/$old_string([^0-9])+/$new_string/g' $FILENAME
The parentheses are also unnecessary in this case if you are not using backreferences (and it doesn't look like you are.)
sed -i -r 's/$old_string[^0-9]+/$new_string/g' $FILENAME
One last thing: bash doesn't parse variables inside single-quotes, so
$new_string will not be replaced by any bash variable you may have set in your script but will be used literally in that
sed command. If you use double-quotes, they will be replaced.
sed -i -r "s/$old_string[^0-9]+/$new_string/g" $FILENAME
Since the file doesn't contain anything after the string you want to replace, the
[^0-9]+ part of the regex has nothing to match. It would work if there was a space after the IP address. We can match the end of the line instead with
sed -i -r 's/18.104.22.168$/22.214.171.124/g' $FILENAME
One more update. This one matches any character that isn't a number or no characters at all. For this one we need the parentheses to group the two options.
sed -i -r 's/126.96.36.199([^0-9]+|$)/188.8.131.52/g' $FILENAME
Since we have the parentheses, you can use a backreference to include whatever was matched:
sed -i -r 's/184.108.40.206([^0-9]+|$)/220.127.116.11\1/g' $FILENAME