A bull market is well underway, and investors have been treated to a series of fresh new highs for indexes like the S&P 500. That being said, if you're looking to add quality businesses to your portfolio, consistently increasing your positions in great stocks is a wise move in any market environment. The composition of your portfolio and the performance it generates in different market landscapes is more dependent on your risk preferences, investing goals, and the types of companies you generally gravitate toward.

If you have a larger chunk of change -- say $5,000 -- to invest in stocks right now, here are two names to consider that could take advantage of the bull market but should serve you well in any market environment.

1. HubSpot

HubSpot (HUBS 0.80%) is a software-as-a-service (SaaS) company that provides a range of services to small and medium-sized businesses. These offerings include marketing automation software, sales customer relationship management (CRM) software, content management software, and business-to-business (B2B) software.

The company has been busy incorporating artificial intelligence (AI) mechanisms into its array of services. These include an AI website generator; AI-powered content-writing services for emails, blogs, and web pages; a chatbot builder; and an AI companion called ChatSpot that provides solutions like real-time data and keyword rankings.

Currently, HubSpot controls a roughly 37% share of the marketing automation software market. This is a space that is expected to expand by more than 100% between 2023 and the early 2030s, totaling more than $11 billion globally at the end of that forecast period. Effective online strategies and processes are key to helping businesses of all sizes grow and remain competitive in today's digital world, and HubSpot has a sizable footprint in this space.

In 2023, HubSpot reported total sales of $2.17 billion, a 25% increase from the prior year. The company makes almost all of its revenue from recurring subscriptions. The other, smaller portion of its revenue is derived from professional services like training and consulting solutions. Last year, HubSpot's subscription sales totaled $2.12 billion, an eye-popping 26% jump from 2022. Professional services and other revenue declined 16% to about $47 million.

The company is not currently profitable on the basis of generally accepted accounting principles (GAAP). However, it did generate operating cash flow to the tune of $351 million in 2023, up 29% from the prior year, and ended the 12-month period with cash and investments on its balance sheet of approximately $1.7 billion.

A recent report from Jefferies affirmed its buy rating for the stock while estimating that HubSpot could hit $5 billion in annual revenue by the year 2028. Some Wall Street analysts are pinpointing the shares' 12-month upside potential at anywhere from a median of 15% to 31% on the high end. Regardless of what the stock does in the next year, this looks like a company with tremendous potential left to tap into. That could create a valuable buying proposition for long-term investors. A $5,000 investment will get you 7.3 shares of HubSpot stock.

2. Costco Wholesale

Costco Wholesale (COST -0.39%) continues to report meaningful growth from its tried-and-true warehouse club business model. It's undeniable that the global economic backdrop is creating an operating landscape where many shoppers' purse strings are tighter than in the past and the costs associated with essential spending are driving consumer discontent.

Costco's membership-based model and global chain of 875 retail warehouses where only cardholders can shop is driving steady revenue and profits during this period. For consumers, the ability to pay a relatively modest annual fee (the cost of a basic membership is just $60) to access a range of products and services, including essential items like food in bulk at lower prices, is looking like an increasingly attractive option in this environment.

For Costco, that membership fee model accomplishes multiple goals. While the company makes most of its revenue from merchandise sales, the vast majority of its profits come from the membership fees. Those membership fees as a measure of profits are part of the reason the company is able to sell its products at such low margins. And by creating a barrier to entry to shop in its stores unless the customer has a membership card, Costco ensures when a customer enters its doors, it's usually going to translate into a sale.

That membership model is very sticky, and Costco has an impressive record of maintaining exceptionally high renewal rates. In the company's fiscal second quarter, its renewal rate in the U.S. and Canada (where it maintains the lion's share of its warehouse locations) was 92.9%. Worldwide, its membership renewal rate is 90.5%. Costco finished out the second quarter with 73.4 million paid household members and 132 million cardholders, up 7.8% and 7.3%, respectively from the prior-year period.

The company also closed the quarter with 33.9 million paid executive members (its higher tier that costs $120 annually). It's worth pointing out that executive members now account for more than 73% of worldwide sales and 46% of its paid members. Total Q2 net sales were $57 billion, up about 6% from one year ago. Costco's e-commerce site, which does not require a membership to shop on but costs more for non-members to use, saw net sales jump 18% year over year.

Costco's net income for the quarter totaled $1.7 billion, up 19% from the prior-year period, and membership fees came in at $1.1 billion. While its yield is modest at less than 1%, Costco has grown its dividend by roughly 190% over the last 10 years. And shares have been performing especially well, which also translates into a lower yield, with the stock up 40% from one year ago. For investors seeking steady returns and some passive income, this household name still looks like a solid buy. A $5,000 investment will get you roughly 7 shares of Costco stock.