Ukraine is different because it was handing over stuff to a third party nation, and required bills to expropriate additional budgetary funding for those items.
A lot of the "money" given to Ukraine is just for accounting purposes, when the US hands over some surplus equipment it has to put that in its accounts and give a valuation for the stuff it hands over. It has also given cold hard cash of course.
You can technically have money left over in the pot in federal discretionary budgets but it's not in anyones motivation to have any money remaining because next year theres a high chance the budget will be slashed. If a project generally goes under budget and is processed really well, the surplus cash for costing that will go somewhere else.