All perfect praise be to Allaah, The Lord of the worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
It is not permissible to delay paying Zakah after a full lunar year has passed on it except with a valid excuse and doing this involves sin. Performing Hajj with money before paying the Zakah which is due on it is valid. However, scholars held different opinions as to whether or not the pilgrim incurs sin for disposing of that money in addition to the sin of delaying paying Zakah. The difference in the scholars' opinions regarding this matter is based on the difference about whether Zakah is in relation to the money itself or to the owner of the money. There are two opinions regarding this matter. According to the first, this person is held sinful for disposing of the money whose Zakah is not yet paid while the other opinion is that he is not held sinful for doing so. The first opinion is the more correct one according to Shaafi‘i scholars. An-Nawawi said, "Does the obligation of Zakah relate to the person or the wealth itself? There are two opinions: The later opinion, which is the correct one, is that it relates to the wealth itself and the former opinion is that it relates to the individual."
Another group of scholars held that Zakah is in relation to the individual and not the wealth. Thus, it is permissible and valid for a person to dispose of his money through trade and such. However, he is held sinful for failing to pay its Zakah. Ibn Qudaamah said in Al-Mughni: "It is permissible to dispose of the Nisaab on which Zakah is due upon through trade, gifts and such and the one in charge of collecting the Zakah money is not entitled to cancel any sales."
Hence, your Hajj is valid and you have to pay the Zakah of your money as long as a full lunar year has passed on it regardless whether the money was with you or as a debt that others owed you.