Strictly speaking, it's not so much that we can afford both but we can't really afford either. No amount of foreign aid will be able to fix the world's problems, and cancelling all foreign aid wouldn't be a magic bullet to sort our own house out either. Never mind that cancelling foreign aid seems to be a great way to fix whatever recent issue we might need to spend money on. This week it's flood defences, next week people might wonder if we could do with a few more teachers, last week it was probably police officers or something. Heck, cancelling Trident would be a better way to raise even more money to pay for flood defences, although I suspect that many here wouldn't be too keen on that venture (and I could understand why).
Our flood defences are obviously not up to the job, but that isn't because we've been spending money on foreign aid. More that successive governments have tended to neglect it, or not give the defences the treatment they deserve. Foreign aid -- while not always spent very effectively -- is in its own way just as important. Money spent on Syria, for example, is in response to a not exactly pleasant political situation there causing rather a lot of people to be suddenly homeless for some unfathomable reason.
We could seriously do with better flood defences. That doesn't remotely suggest that cancelling foreign aid is the answer. It's not a choice that exists or needs to be made.