If you took courses that are duplicates of each other then you only get credit once. For repeated courses, UC only allows repeating and grade replacement if the previous grade was C- or lower, but do not exactly say what they do if you do repeat a course with a C or higher grade (probably means that they will take the first C or higher grade, but ask to verify).
https://admission.universityofcalifornia.edu/counselors/transfer/advising/transferring-credits/
Note that a course may be UC transferable but not a direct equivalent to a course offered by the UC campus(es) you are applying to. Such a course could possibly be used to fulfill less specific requirements that describe it (e.g. “an arts or literature course”, “a social science course”), or could be transferred as non-specific credit.