The CGPA matters the most. However, it may depend on your preference for higher study.
For example, If you have higher GPAs in your core courses and but your overall CGPA is a bit lower, then the admission committee, when reviewing your application, will clearly notice your academic strengths and will recommend you for admission in most cases. So, overall lower CGPA but a higher GPA on your higher-level courses will matter if you apply for graduate or Ph.D. studies.
The difference between GPA and CGPA (If someone in Quora cares to know):
GPA and CGPA both measure the performance of an individual in a course. The main difference is that GPA measures a single unit or semester’s performance, and CGPA measures the performance throughout the course, including all units and semesters.