Investing in exchange-traded funds (ETFs) is usually associated with safe and stable long-term investing. But not all ETFs are the same. And just because you invest in one doesn't mean you can't still earn a great return.

Two ETFs that have produced some fantastic returns for investors in the past five years are the Vanguard Information Technology Index Fund ETF (VGT -0.29%) and the Vanguard Growth Index Fund ETF (VUG 0.06%).

Here's why these funds have performed so well, and why it may not be too late to invest in them today.

Investor calculating stock returns on a calculator.

Image source: Getty Images.

Vanguard Information Technology Index Fund ETF

This Vanguard ETF invests broadly within the tech sector. It has more than 300 stocks in its portfolio, giving exposure to companies involved with semiconductors, application software, electronics components, and many other areas of tech.

And with tech stocks surging in value in recent years due to the excitement surrounding artificial intelligence (AI), it's perhaps not too surprising to learn that this ETF has risen by 135% in the past five years. And that rises to around 141% when you include the fund's dividend.

By comparison, the S&P 500's total returns (which include dividends) are 109% over that period. While the past five years have been good ones for the market as a whole, tech stocks have done particularly well.

Given the strong trends in AI and the investments that continue to flow into AI-related projects, this ETF can still be an excellent option for your portfolio. While it's by no means a pure AI investment, the stocks within this ETF can all benefit from trends related to it as tech spending as a whole is likely to increase as companies invest in next-gen technologies and upgrade their existing infrastructure.

The fund also charges a modest expense ratio of 0.09%, which can be crucial in ensuring that fees aren't taking a big chunk of your returns. Most of the stocks in the ETF account for no more than 4% of its total holdings, with the exception being the big three: Apple, Microsoft, and Nvidia, which together make up nearly 46% of the fund's portfolio. But given their leading positions in tech, how these stocks go, other tech stocks are likely to follow, anyway.

If you're looking for a long-term investment and don't mind the volatility that can sometimes come with tech stocks, the Vanguard Information Technology Index Fund can be an excellent ETF to buy and hold for years.

Vanguard Growth Index Fund ETF

For a more balanced option outside of just tech, you may want to consider the Vanguard Growth Index Fund ETF. It simply focuses on the largest growth stocks in the country. It is, however, a bit more concentrated since it has positions in 166 stocks (as of April 30).

While tech stocks take up the bulk of the portfolio at more than 57% of the ETF's holdings, it also has a strong position in other sectors. Consumer discretionary stocks account for 19% of its portfolio, and industrials make up close to 10%.

This ETF has also delivered market-beating returns for investors, but with less focus on tech, the gap between it and the S&P 500 hasn't been as significant as has been the case with the Vanguard Information Technology ETF.

VGT Total Return Level Chart

ETF Returns data by YCharts.

The same top three stocks that make up the bulk of the Vanguard tech fund are also the top three in this ETF. But in the Vanguard Growth ETF, Apple, Microsoft, and Nvidia combine for around 31% of its holdings.

Having less exposure to these big three stocks helps explain why the fund's performance hasn't been as strong as the other Vanguard ETF listed here. However, that also means more diversification for investors and potentially less risk in the long run.

The more diversified Vanguard Growth Index Fund ETF, which charges a lower expense ratio of 0.04%, can be a better option for more risk-averse growth investors who don't necessarily want to be all-in on tech.