These are not issues to worry about. Under the conveyancing acts the loan will go with the property - ie be payable from the property it is secured by (unless will states otherwise) and the charity will sell to get the cash.
If you donate the property the charity will pay inherit the cost base - no triggering of CGT to you or your estate and the charity will pay none either if they have tax exempt status.