Honestly I don't think there's any realistic way to decide in general whether giving assistance to person A vs person B is more "rational" or even more "effective", but it's good to at least be aware that some charities/NGOs/etc. are at least trustworthy and ensure a high % of donations do actively go towards providing help, rather being swallowed in marketing and admin budgets.
It's counterproductive to insist that nonprofits operate without operations budgets.
I pay them money. Charity pays consultants to turn that into more money (plus admins to manage the consultants). Consultants determine that a fraction of that money should be used to solicit more donations. Research indicates best source of new donations is in fact existing donors.
At this point charity is spending money I gave them to extract further donations from me. The ice-cream cone is now licking itself :/
For instance; if everybody sticks to the principle of murder being wrong despite the consequences, then there will be fewer misguided mass murderers, and this is better for society in the long run than everybody going around committing murders they believe to be justified by some end.
You shouldn't; doing so would be irrational. There is a fairly decent chance that your relative, if they survive, will be in a position to help you in the future. But the random person on the other side of the planet? The chance of them randomly helping you in the future is about one in a few billion. Particularly if they don't know who their benefactor was, so they couldn't deliberately repay the favor to you.
So the rational/selfish position is to always put family and friends first, before strangers.