The money didn’t go to “another country” the money was allocated to Ukraine‘s spending account with US defense contractors, and went straight back into the US economy. War is good for the economy.
Federal spending cuts are bad for the economy because they reducing inflationary pressures and make the mountain of debt bearing down upon the US, worse.