The verdict
A main lift and its top-up, not two rivals. Both are barbell compound lifts listed at beginner level, and both list the front and side delts as primary muscles. The overhead press is listed as a push through shoulder flexion and elbow extension, and it is one of the main lifts in Starting Strength and 5/3/1: it builds the shoulders and triceps and asks your trunk to stay rigid. The upright row is listed as a pull through shoulder abduction and elbow flexion, and the record suits it to lifters who want one move for the side delts and upper traps with a light to moderate load. Press first as the lift you track; row after for the delts and traps.
Muscles, equipment, force and level from the PasteLift exercise library records for the upright row and the overhead press. Sets and reps from the ACSM position stand, cited below.