United flights mostly arrive at Terminal C (some United Express arrive Terminal A and some intl flights may arrive Terminal B).
In either case, you would have to re-clear security at the SAS pier at Terminal B. Are you on one ticket? If so, 2 hours should be fine, it is within the MCT in most cases:
MCT EWR
STANDARD.D/D...D/I...I/D...I/I.
ONLINE 1.00 1.15 1.30 1.00
OFFLINE 1.00 1.15 1.30 1.00
** OR * ARE ALL
UA-SK DI 1.05 FLT 1 - 1744 - ALL
UA-SK DI 1.05 FLT 3250 - 6539 - ALL
UA-** DI 2.00
If you are travelling on two different tickets, there is obviously a risk if the incoming flight is late. If not, two hours is plenty of time.