The chip sector (also known as the semiconductor sector) has grown in importance at an accelerated pace over the last few years as consumers and businesses demand more digitally capable products and services. 

In fact, the iShares Semiconductor ETF (SOXX 1.30%) has delivered a five-year return of 180%, which crushed the 121% return of the technology-heavy Nasdaq 100 index over the same period. Investors are clearly seeing value in the companies involved in the chip space, and it's never too late to start building new positions.

Ultra Clean Holdings (UCTT 1.28%) and MKS Instruments (MKSI 1.08%) are in the semiconductor-service segment, and they both reported their second-quarter earnings results on July 28. Here's why both stocks are a buy for the long term. 

1. The case for Ultra Clean Holdings

Ultra Clean Holdings doesn't produce any chips itself, but it does have 30 years of experience serving the semiconductor industry. The company provides a range of products and services which help to add precision to the manufacturing process and longevity to its customers' equipment. 

Chipmakers generate the most income when their production processes deliver the highest yield -- in other words, when they get the maximum level of output from their facilities. Ultra Clean's ChemTrace service can ensure clean room environments are operating at optimal levels, from air purity to chemical purity to equipment cleanliness in order to prevent costly contaminations. 

But that's just one of many services (and products) the company offers. It can also test and calibrate fabrication equipment to ensure it achieves the highest level of precision, as well as perform complex system integrations.

2021 was a big year for the semiconductor sector, thanks to a combination of stimulus dollars and major supply shortages (which led to higher prices) from pandemic-related lockdowns in 2020. Therefore, much of the industry has struggled to generate meaningful growth in early 2022 compared to last year's stellar numbers. 

But Ultra Clean is bucking the trend, generating $1.17 billion in revenue during the first half of this year alone, representing a 25.7% year-over-year increase. It has also maintained a high level of profitability with $90.7 million in net income in the first half, which translates to $1.99 in non-GAAP (adjusted) earnings per share (which excludes costs that are mostly one-off or non-recurring). 

The company is proving its ability to perform in difficult times, and its stock trades at a bargain price-to-earnings multiple of just 7.9 based on its trailing-12-month non-GAAP earnings. That's a 62% discount to the iShares Semiconductor ETF, which trades at a multiple of 21.1 right now and could set up an ideal entry point for long-term investors. 

2. The case for MKS Instruments

Like Ultra Clean Holdings, MKS Instruments has been around a long time -- its history spans more than 60 years. It has built a solidified reputation in the semiconductor industry, and the company makes an eye-popping claim that its products and services touch every single chip produced globally, in one way or another.

Digital products and services are growing more demanding of the semiconductors that power them, and as such, chips are required to be smaller and more portable while delivering even more processing power. It creates complex production challenges, which can even involve new materials and components to help the innovation process along. Managing these obstacles is where MKS Instruments shines.

It supports producers at all four stages of the semiconductor fabrication process with a number of different products and services. But that's not all; the company also offers a range of equipment to support the production of end products like solar panels and flat-panel displays (used in TVs, computers, and smartphones). 

MKS Instruments had a big year in 2021, delivering $2.9 billion in revenue, which was a 26.6% jump compared to 2020. But it grew its non-GAAP earnings per share by a whopping 53.1% to $11.38 over the same period because of a much higher operating margin. 

So far, in 2022, the company is treading water and tracking the lofty 2021 levels without generating much growth overall. But it did produce 19% sales growth in its semiconductor segment in the second quarter, which implies there's still some underlying strength in that industry even if the rest of its business is temporarily leveling off. 

For investors, the good news is that MKS Instruments pays a modest quarterly dividend of $0.22 per share, which is equivalent to an annual return of 0.7% at the current share price. That means investors will earn income while they wait for growth to resurge in the coming months and years.

Like Ultra Clean Holdings, MKS Instruments stock trades at a hefty discount to the broader industry represented by the iShares Semiconductor ETF. This time it's 48%, so it might be a good chance for investors to get involved.