Warning: SPOILERS for Ant-Man and the Wasp.
As a prequel, Ant-Man and the Wasp's story happens a short but undisclosed amount of time before Avengers: Infinity War. However, in the mid-credits scene, the film synchs up with the universe-altering events of Thanos' wiping out half of all life in the universe with the Infinity Gauntlet.
Before some of the key characters in Ant-Man and the Wasp suffer the same tragic death as the rest of the MCU, the film itself deals with the fallout of Captain America: Civil War. According to the timeline given by Scott Lang's (Paul Rudd) parole officer, FBI Agent Jimmy Woo (Randall Park), Scott was arrested in Berlin two years prior. His plea bargain included house arrest at his San Francisco home, which allowed him visitation rights with his beloved daughter Cassie (Abby Ryder Fortson). This places it rather close to Avengers: Infinity War, but it takes a while for it to be revealed just how much.
Scott's legal status was referenced by the Avengers in Infinity War, and keeping him from further violating the Accords is why Captain America's team opted not to recruit Ant-Man to fight in the Battle of Wakanda. However, had the Avengers gone looking for him, they may not have found him: the end-credits scenes reveal that Ant-Man & the Wasp takes place at the same time as Avengers: Infinity War.
Ant-Man & The Wasp's End-Credits Scene Connects Directly to Avengers: Infinity War
Ant-Man & the Wasp's mid-credits scene shows Scott entering the Quantum Realm to collect Quantum healing particles to help Ghost stay stable. His mission is a success, but before Hank, Janet, and Hope and retrieve him, it's revealed that all three have been turned to dust as a result of Thanos' finger snap from the end of Avengers: Infinity War. Scott is left trapped in the Quantum Realm, presumably waiting for rescue in next year's Avengers 4.
In the MCU's timeline, Ant-Man and the Wasp's post-credits scene takes place during the climactic minutes of Avengers: Infinity War; the Battle of Wakanda is happening on the other side of the world, and New York City was invaded the day before (not that Hank, Hope, Janet, and Scott are aware of the conflict). There's no mention of Thanos or his quest in the main film, however, which would suggest it takes place shortly before his arrival.
Ultimately, this means that the MCU's various movies are all lining up ahead of Avengers 4. How Scott deals with the realization that Hope, Janet, and Hank have suddenly died - along with half the universe - is now something fans can't wait to see dealt with next year.