Dividends should be taken after all company bills are paid, yes - they come out of the profit (after tax).
Freelancer invoices are company bills, and should be paid before the profit can be calculated. So, until bills are paid, there is no knowing how much profit there is to pay tax on and then share out as dividends to the shareholders (often directors).
However, it is fairly common that dividends will be taken out of a small company on an ad-hoc basis, based on a rough calculation. Its fine as long as the money will be there at the end of the accounting period, and people tend to bank on this balancing out over the year. There is no particular 'freelancer pool of money' - its up the company to manage its money over the financial year.
It only gets illegal when the company comes to file its accounts and tax return and can't pay, or if it doesn't pay it's bills and gets either taken to court or the creditors (unpaid people/companies) file to make the company bankrupt. At this point, the official receiver is called in and can decide that the people have acted illegally, and penalise them (can force sale of assets to pay bills, and/or disqualify them from being a director)
If you are waiting to be paid, and its been a long time, and you've sent a letter asking for the payment, then send another warning that you will take legal action if not paid. If this doesn't work, depending on the amount owed, go to the small claims court (up to £10k, can be done online, I think)
Hope this helps