The S&P 500 (^GSPC 1.02%) index gained 24% in 2023, which is more than twice its annual average return since its inception in 1957. The momentum has carried into 2024, with the index up another 10% so far.

But some individual stocks are currently taking a breather after delivering positive gains last year. Zscaler (ZS 1.28%) stock is down 8% in 2024, and Workiva (WK 0.86%) has fallen 14%. Both companies are packed with long-term potential, so here's why the recent weakness might be a great buying opportunity for investors.

1. Zscaler

The cybersecurity industry is growing in importance, especially with the rise of generative artificial intelligence (AI). Palo Alto Networks recently reported a tenfold increase in the frequency of phishing emails over the last 12 months, caused by malicious actors using generative AI to craft realistic content to target employees and compromise the organizations in which they work.

Zscaler's cybersecurity technology helps fend off those threats. The company's Zero Trust identity security treats every online login attempt as hostile and analyzes the user's credentials, their location, and the device they are using. This reduces the risk of an attacker gaining access to critical digital assets, even if they successfully steal an employee's login information.

Zscaler's Zero Trust Exchange goes a step further, because it only connects employees to the digital applications they need to complete their jobs (rather than the network itself). Therefore, even if a bad actor bypasses the identity security layer, they can't move laterally or gain access to other assets within the network.

Zscaler serves more than 7,700 businesses, including 40% of the Fortune 500 companies, but its highest-spending customer cohorts are growing the fastest. In the recent fiscal 2024 second quarter (ended Jan. 31), Zscaler had 2,820 customers spending at least $100,000 annually, which was a 21% year-over-year increase, and it also had 497 customers spending at least $1 million, which was a 31% jump.

Zscaler generated a record-high $525 million in revenue during Q2, a 35% increase from the year-ago period. It prompted management to slightly increase its full-year revenue forecast for fiscal 2024 to $2.12 billion (from $2.1 billion). The company thinks it can more than double its annual revenue to $5 billion in the coming years by acquiring new customers and helping existing customers expand their spending to combat the growing threat landscape.

Zscaler stock is down 8% in 2024, but it's down 47% from its all-time high, which was set during the tech frenzy in 2021. Considering how much future growth the company is forecasting, this appears to be a great opportunity to buy Zscaler stock for the long term.

2. Workiva

According to Statista, the average organization used 130 software applications to run their operations in 2022. That creates a nightmare for managers tasked with monitoring the progress of their employees, because it often involves tracking workflows across dozens of those apps. Workiva built an innovative platform to help businesses solve that problem and thrive in the digital world.

Workiva connects to most of the major storage, productivity, and record-keeping applications to aggregate their data onto its dashboard, creating a single source of truth. For example, managers no longer have to access specific workflows in Microsoft Excel and Alphabet's Google Drive, because they can simply view the data they need through Workiva instead.

From there, Workiva offers hundreds of ready-made reporting templates, so companies can quickly compile regulatory filings for the Securities and Exchange Commission (SEC), or create reports for their executive leadership team. This saves significant amounts of time and money.

Workiva is now focusing on its largest opportunity so far: a platform for ESG (environmental, social, and governance) reporting purposes. Governments all over the world are imposing strict rules on large businesses, requiring them to track their carbon footprint, the diversity of their workforce, and their social impact on the surrounding communities.

Consulting firm PwC believes ESG reporting could be a $17 billion industry annually across Europe and the Americas by 2026. Workiva created a platform to help organizations build an ESG framework, collect data, and compile reports for key stakeholders to satisfy the expanding regulatory requirements.

Workiva generated $630 million in revenue in 2023,  a 17% year-over-year increase. It serves 6,034 customers, and its most valuable cohort -- those spending a minimum of $300,000 each year -- saw 32% growth in the fourth quarter. It highlights the growing need for data aggregation software among large, complex organizations, and that demand will likely accelerate in the future as more of them fall under new ESG rules.

Workiva has a market capitalization of just $4.4 billion as of this writing, so the ESG opportunity could drive significant upside in its stock price over the long term. The 14% dip this year might be the perfect opportunity for investors to buy in.