Well, not so much avoid, as rather get to pay a much lower rate.
APD is charged based on the destination. If you have a stopover of 24+ hours en-route to your final destination, then that counts as the destination for APD purposes (as for all taxes; if you stay somewhere for fewer than 24 hours en-route, you are generally considered as a transit passenger {yes, even if you leave the airport} and consequently, if you stay for more than 24 hours, you are considered generally for tax purposes to have reached a destination, even if not your final destination).
So, an LHR-DUB-JFK ticket flown on the same day would attract the longhaul UK APD rate (standard rate: £200), whereas an LHR-DUB/stopover of 24hr+ /DUB-JFK ticket would attract the shorthaul UK APD rate (standard rate: £26).