Given that you're talking about UA and LH, I will assume that you are talking about transatlantic travel. With this assumption:
If the first overwater segment is marketed by UA, the ticket will by default be issued on UA stock. AmEx can change that if they'd like, but there probably isn't any reason they'd want to.
Let's say your itinerary is EWR-FRA roundtrip.
If the first overwater segment is EWR-FRA operated and marketed UA, then it will probably ticket on UA stock.
If the first overwater segment is EWR-FRA operated and marketed by LH, then it will probably ticket on LH stock.
If the first overwater segment is EWR-FRA operated by LH but booked as a UA codeshare, it will probably ticket on UA stock.