When many investors think of tech stocks, they think of high growth potential, particularly in a short amount of time. While that can happen, you don't want to invest with only that thought in mind. You want to focus on the long-term potential of a company.

You can't predict how stocks will perform in the near term, but you can be certain that great businesses will likely provide value over time. Here are three tech stocks to consider for the long haul.

1. AT&T

There's no doubt that it's been a rough past decade for AT&T (T 1.02%), with the stock down around 45% over that span. The blame can be spread around, but a large portion comes back to AT&T veering off from its core telecom business to pursue media and entertainment.

In October 2016, AT&T agreed to acquire Time Warner for $85.4 billion ($108.7 billion, including Time Warner's debt). Fast forward to 2022, and the company spun off its WarnerMedia business for $43 billion. On one end, the deal was the nail in the coffin for AT&T's media and entertainment ambitions -- which is a good thing -- but on the other end, the move came with a slash to AT&T's dividend, from $2.08 per share annually to $1.11.

With a trailing-12-month dividend yield above 7%, AT&T is one of the more lucrative dividend stocks in the S&P 500 index. A high dividend yield isn't always a good thing since it increases as stock prices decrease, so you never want to take it at face value. But in AT&T's case, I believe the dividend is attractive enough to warrant a long-term investment, with the upside far outweighing the downside.

T Dividend Yield Chart

Data by YCharts

AT&T is operating in an industry that's become indispensable: telecom. From mobile phones to WiFi to satellites, the telecom industry is powering our digital-dominant (and reliant) society. That stability and the natural margin of safety from its dividend make AT&T a good investment for the long haul.

2. Microsoft

Microsoft (MSFT 1.82%) is the world's second-most valuable public company, with a market capitalization of over $2.5 trillion. Even after decades of sustained success, the company is well-positioned to be a lucrative investment for the long haul, mainly because of who Microsoft's primary customers are: other businesses.

When money is tight, it's more likely consumers will cut back on the newest electronics than corporations that rely on the products and services that Microsoft provides. From Azure cloud services to Office software like Excel to recruiting on LinkedIn, countless businesses lean on Microsoft to power their daily operations.

It doesn't make Microsoft recession-proof, but it's as recession-resistant as you'll find in big tech.

As AI comes to the forefront of tech, Microsft's investments and ongoing partnership with ChatGPT's creator, OpenAI, should boost its Azure platform as it aims to take on Amazon's AWS in the cloud space. Cloud computing is a high-margin segment, so Microsoft's bottom line should see major benefits as the global cloud market expands.

Microsoft's dividend isn't quite the selling point like AT&T's -- it's $0.68 per share quarterly, yielding just 0.79% -- but it's an added bonus to the growth opportunity Microsoft's stock presents.

3. Taiwan Semiconductor Manufacturing

Taiwan Semiconductor Manufacturing (TSM 1.26%) (TSMC) is the world's leading chip manufacturer. It pioneered the foundry model, where instead of making chips for general sale, they make chips specifically designed for other companies' needs. Customers include Apple, Tesla, Amazon, Nvidia, and many other prominent tech companies.

TSMC's sales had slowed recently as macroeconomic conditions caused a drop in demand for its chips used in smartphones and other consumer electronics. However, AI has breathed new life into TSMC's bottom-line growth. It's been a chain reaction: Companies training AI need data centers, data centers need GPUs, and companies that make GPUs (like Nvidia) need the chips that TSMC produces.

Demand surrounding the AI chip market shouldn't be a short-term thing for TSMC. The AI chip market was valued at around $28.8 billion in 2022. By 2030, it's expected to be over $304 billion, according to research by Next Move Strategy Consulting.

That's a compound annual growth rate of 29%, and as TSMC is the global leader in the space, it's reasonable to think its revenue can grow at a comparable pace. Even growing by roughly one-third of that until 2030 could double TSMC's revenue.

TSMC's quarterly dividend is $0.46, with a yield of around 1.7%. Most investors don't look at TSMC for its dividend, but its yield is higher than the S&P 500's average. It may not seem like much now, but it can noticeably add to total returns over time.