RIO DE JANEIRO — President Joe Biden, on one of his last days headlining an international summit, attempted to shore up support for Ukraine’s war against Russia and pressure Hamas to accept a cease-fire deal with Israel, hoping to put two of his biggest foreign policy crises on a better footing before leaving office.