You may be aware that marriage revokes a Will unless you state in your Will that you are making it in contemplation of marriage. That’s not the same for divorce. Divorce will not revoke your Will
Where a person makes a Will and subsequently divorces, has their marriage annulled or dissolves their civil partnership then their former spouse or civil partner is deemed for the purpose of the testator’s Will to have died on the date that the marriage or civil partnership ended. This is the date on which the decree absolute or decree of dissolution was issued.
So if the former spouse or civil partner has been appointed an executor or trustee under the Will then the appointment will not take effect. Similarly, if the former spouse or civil partner were to receive any benefit under the Will then this gift would fail and any substitute gift provisions would apply. If the former spouse was the only beneficiary and there were no substitute provisions then the estate would be distributed in accordance with the rules of intestacy which is unlikely to be how you would like your estate to be distributed.
It is important to remember that if you are currently separated and going through divorce or dissolution, but the decree absolute or decree of dissolution has not yet been issued then you Will will not prevent any appointments to your spouse or civil partner taking effect.
For this reason you should consider amending your Will even before the divorce or dissolution is completed.
Finally, it is also possible to exclude this happening by stating explicitly in your Will that you want your spouse to benefit evenif divorce takes place.