For UC application purposes, all transferable college courses and grades from all colleges attended are used in the GPA recalculation as described here:
http://admission.universityofcalifornia.edu/transfer/preparing-admission/transfer-gpa/index.html
For law school application purposes, all college courses and grades from all colleges attended are used in the GPA recalculation (which may be different from how the colleges calculate GPA):
https://www.lsac.org/aboutlsac/policies/transcript-summarization
For PhD programs, admission is more holistic, with undergraduate research and related recommendations also being very important. Grades in upper level in-major courses are likely more important than other grades.