A mere fraction of the money spent on this war should have been spent on the border. That’s the biggest issue, outside of a corrupt government and the Deep State, inflicting damage on the US.
And the problem with the border is a matter of policy, not resources. Thats the root of it. You have the means to control the border, Trump did it pretty well. I think he just wanted an extra @5 billion for the wall, which would be useful but not critical. That is really small change.
The real problem is that you have powerful domestic interests, currently in charge, that dont want that border controlled. This is not a fiscal problem, it is political.
Aid to Ukraine is irrelevant.