Both research and internships can be enriching and both can help you learn new skills. Research can help you gain confidence in approaching open-ended questions that no one has ever answered; it can engage you in a global community of scholars pursuing answers to some of the field’s most important questions. However, research will probably not help you learn the latest AI or web framework. Research is not likely to develop your engineering teamwork skills, as computing research teams are often not as large as production software development teams.
If you’re not sure which of these skill sets matter more to you, see if you can experience both! And if you only have time for one, consider choosing the one that’s only easily possible while you’re at a college or university — research.
That said, there are other considerations beyond what you might learn. If you’re sure you want to pursue a career in research, an undergraduate research experience will be far more valuable than an industry internship. But if you need to make money to pay for school, industry internships often pay more than research does. One way to manage these tradeoffs is to see if you can find ways of incorporating research into your studies, through an undergraduate thesis, a research capstone, or an independent study with a professor. Another is to pursue an internship at a government or industry research lab.