Yes, it's illegal to speed while passing another car. In fact, it's illegal to drive in excess of the speed limit at any time, no matter the circumstances.
It's a common misconception that you can speed when overtaking, particularly when you're driving on country roads and you rightly want to get past as fast as possible. But while it might feel safer to try and complete an overtaking move quickly, you must always obey the speed limits or risk a significant fine.
According to the Royal Automobile Association, the reason you can't speed while passing a car is because courts describe driving over the speed limit as an absolute offence - one that doesn't have exceptions and for which there are no excuses. However, the RAA also notes that it's illegal for a driver to increase their speed while another car is trying to pass.
While most states and territories don't directly address how to pass cars on the road safely, there are a couple of exceptions. The New South Wales Roads and Maritime Services website has a page dedicated to overtaking, as does the Western Australia's Road Safety Comission website.
Both pages repeatedly advise that overtaking other vehicles can be dangerous as it's difficult to judge the amount of distance required to complete the manoeuvre safely, but that this difficulty can't be mitigated by speeding. They reiterate that some of the dangers of overtaking can be lessened through the behaviour of drivers who are being passed; if someone is trying to pass you, you should keep left, stay in your lane, and refrain from increasing your speed.
The exact penalties for driving in excess of the speed limit differ state by state and vary in severity according to just how fast you've been caught driving. But beware, the penalties include fines and demerit point penalties.
As always, remember that if you're caught speeding, then you could be in breach of your insurance agreement. While you should always check your specific agreement for details, be aware that any unlawful behaviour could jeopardise your coverage.
This article is not intended as legal advice. You should check with your local road authority to verify the information written here.