Using Perl
~$ printf "ABC123xxx:: 2345 ABC345yyy:: 5678 ABC986zzz:: 7955\n" | perl -pe 's/\h+ABC/\ ABC/g' ABC123xxx:: 2345 ABC345yyy:: 5678 ABC986zzz:: 7955
Above Perl answer is most similar to the excellent sed answer posted by @cuonglm. In Perl-family languages, the -pe commandline flags give sed-like behavior, i.e. execution, linewise-with-autoprinting. the \h+ atom stands for horizontal whitespace.
Using Raku (formerly known as Perl_6)
~$ printf "ABC123xxx:: 2345 ABC345yyy:: 5678 ABC986zzz:: 7955\n" | raku -pe 's:g/ \h+ ABC/{"\n"}ABC/' ABC123xxx:: 2345 ABC345yyy:: 5678 ABC986zzz:: 7955
The above Raku answer (formerly Perl6) is almost identical the Perl(5) answer. However to use the :global modifier, it gets moved to the head of the s:g/// idiom. Also, if you want run code within the replacement-half [ example {"\n"} ], simply enclose it in curlie braces, which helps with readability--very easy to see a \n newline is being inserted.
Perl References:
https://perldoc.perl.org
https://www.perl.org
Raku References:
https://docs.raku.org
https://raku.org