Shares of Upstart Holdings Inc. tumbled after hours on Tuesday after the artificial-intelligence lending platform forecast a second-quarter loss and sales that missed Wall Street’s expectations.