I will be travelling to India from DFW with a connecting flight on United. I have a 2-hours layover in EWR Newark. Do I need to do immigration in Newark or in DFW? Both my flights are with United. What would be my terminal for the Mumbai flight from EWR? Is 2 hours enough?
Assuming you have purchased this as a single ticket, two hours should be quite sufficient unless your flight is significantly delayed. You won't go through any kind of immigration control departing the US, just normal airport security at DFW and Indian immigration when you arrive at BOM. At EWR, all you'll need to do is get to your next gate and board the plane.
Most United flights at Newark depart from Terminal C, and that seems to include the normal gates for DFW and BOM flights. If you do wind up in Terminal A, there is a shuttle bus between terminals inside the secure area that you can take so you won't have to go through security again.
You only need to walk to the right gate, and 15-20 minutes are usually enough if you don't diddle around in shops.
Also, if your incoming flight is late, they will usually wait (as they would be responsible for your overnight stay and rebooking if the connection fails)