Since April 2023, the simple 19% Corporation Tax rate is gone for many companies. It has been replaced by a tiered system that can create an effective marginal tax rate of 26.5% on some profits.
If your profit falls in the "buffer zone" (£50k - £250k), you don't pay 25% on everything. Instead, you pay 25% reduced by Marginal Relief.
However, the math often works out to a marginal rate of 26.5% on the profits within this band.
Corporation Tax is paid before dividends are distributed.
Disclaimer: Associated companies can reduce these thresholds. Consult an accountant.