The Basic Rules are a complete copy/paste from the same sections in the Players Handbook. The text is exactly the same, so it's a great recommendation.
It's cheap, has the basic rules and has one of the best adventures written for D&D in modern times. My D&D veterans I have played with for the last 20 years loved it, and so did my 10, 8 and 6 year old kids who had never played before.
Then, of course, you'll want the players handbook and the larger adventures. All of the published modules that I have read have been of an excellent standard, so just pick one that excites you as a DM. My favourite so far is Tomb of Annihilation.
Also, if any of your players are remote there are now excellent online tabletops. Fantasy Grounds and Roll20 are both excellent, but I prefer Roll20 as it has a gentler learning curve and is free if you don't want to pay for any of the fancy extras.
This was me 2-1/2 years ago. I started with the Free Basic Rules many others in this thread have suggested. My first purchase was the D&D Starter Set for under $20 and a cheap 5-set of dice for under $10.
I signed up on Roll20 and tried for about 30 days to get into a game and found one that lasted one session only. I also joined a Meetup group for the Friendly Local Hobby Gaming Store with a bit better results but never stuck with a group more than a few months because people went to other groups or moved or work scheduled changed or life in general. When I could I would play Adventurer's League (AL) one-shots at the Hobby Store on the weekends with much better results. These options allowed me to learn by playing.
I bought the Player's Handbook after spending a month or so with the Basic Rules and the Starter Set. If you are interested in being a DM, definitely plan on getting the Dungeon Master's Guide and Monster Manual. What, if anything after that, will depend on your play style and game ambition.
This website is also a pretty good guide with lots of informative articles and threads. I visit almost daily. Lots of old D&D vets here that are always willing to help answer questions.