Back when Grand Theft Auto 5 and its multiplayer component were still fresh, Rockstar was seemingly intent on weaving the two together and having them occur in a shared fictional universe. Officially, the events of GTA Online took place a few months before the storyline of GTA 5 (meaning post-North Yankton). However, since then, the game expanded in ways which conflict with this canonicity, raising the question of whether the two modes still share a universe?
The initial set up was that time in GTA Online didn't really move forward, at least not in the traditional sense. Basically, the game would take place in 2013 perpetually, always a few months prior to the in-universe beginning of GTA 5's storyline following the prologue which washes Trevor, Michael and Franklin together. A number of references in game are made to maintain this continuity.
Early on in your progression through GTA Online, you meet Ron and Trevor who play central roles in the story mode. Neither make any mention of events that take place in the story, precisely because they haven't happened yet. Trevor is still living his (comparatively) quiet life as a criminal drug addict just as his has ever since the North Yankton job and up until learning that Michael is still alive and kicking.

The player also eventually hooks up with Lester Crest, another major character in story mode. It is assumed that players go through much of Online's progression "before" the story events occur, since in a cutscene prior to the jewelry store heist in the storyline, Lester refers to the GTA Online protagonist as a possible crew member, but then dismisses the idea calling them "too unpredictable" (which is funny because (1) players would go on to conduct heists in Online and (2) the average random player is indeed incapable of successfully completing a heist).
All of this suggests that GTA Online does indeed occupy the same timeline and fits in neatly prior to the events of GTA 5. However, certain discrepancies have popped up since launch way back when.
Firstly, the huge amount of DLC released since 2013 has made Online much more content-rich — where did all those flashy vehicles disappear to? Why can't Franklin own a lowrider, for example? Why can't the crew make use of weaponized vehicles?
Another factor is the increasing absurdity of certain updates.
The Cunning Stunts DLC and its spin-offs completely shed the pretense of realism by suspending huge death-trap race tracks in the air with spinning floating pipes and checkpoints which turn one vehicle into another in a puff of colorful smoke. None of this would fit GTA 5's much more realistic setting.