The UK economy recorded surprise growth in July as the AI spending boom helped deliver a boost, despite emerging signs of strain on households.