Consumer confidence slid in July from the prior month on dimmer views of the U.S. economy’s prospects and lingering concerns among higher-income earners about global market conditions.