There are in-general two different approaches taken to leveling in D&D (not just 5e), experience points and milestone leveling.
Experience Points (XP)
This is the classic approach in D&D, and is also used in most other RPG's. In short, players are awarded XP for doing things, and their level is a direct function of their total XP. Pretty much every game system that uses this approach has a chart somewhere that shows how much XP is required for each level (for example, in D&D 3.5e, you need to earn XP equal to 1000 times your current level to progress to the next level (so level 2 requires 1000 total XP, level 3 requires 3k, level 4 requires 6k total, etc)).
The most common case of this is an in-universe event-driven approach. Players overcome obstacles, and get XP as a reward for doing so. The most well known approach to getting XP in this case is defeating opponents in combat, but obstacles don't have to be combat encounters, and you don't necessarily need to win to get past them. For example, I've had players literally buy-out the mercenaries that the main villain sent after them before, and I usually award XP for getting past puzzles in dungeons or successfully getting through social encounters that have a major story impact. This is the approach that the DMG in 5e primarily talks about, and was the only approach listed in a number of previous systems.
The other common approach with XP involves awarding some flat amount of XP per unit of play-time. The WotC Adventurers' League uses this approach, calling the points "Adventurers' Check Points". This has the advantage that players (and DM's) can count on consistent progression no matter how much combat or other stuff goes on in each session, but has the disadvantage that it makes it easy for the character's power to get out of sync with the environment (though this is not as big of a problem in 5e as it is in, for example, 3.5e or Pathfinder).
XP is, in-general, useful when you expect leveling to take a long time because it gives the players tangible evidence of their progress between levels, but it can cause some interesting issues for you as a DM if you do it in a way that lets the players get out of sync with each other or the environment itself (few things are more frustrating as a DM than your players getting bored because the stuff you're throwing at them is too easy due to them being over-leveled).
Milestone Leveling
This is the other standard approach. In essence, you as the DM define some condition that needs to be met for the players to level up, and once that condition is met, they just level up. This used to be pretty rare in earlier editions because lots of stuff actually cared about exact XP values (in 3.5e for example, a lot of high-level spells actually cost the caster XP), but in 5e nothing really cares so it's much easier to work with.
Overall approaches I've seen to this include:
- Story-based leveling. Each time the party completes a major plot point, they get a level. This can be really useful for the DM because they can plan each segment of the story around the party's level, but it requires players to be on-board so they stay on track and don't get discouraged by the lack of levels, and also often limits the value of side-quests during the main story.
- The shonen approach. The condition in this case is that the party looks like they're going to be defeated in a combat session that's critical to the story, usually one which they didn't have any chance to win going in. In essence, the same pattern seen in almost all shonen manga and anime (hence the name) where the protagonist suddenly unlocks a power they never knew they had at a critical moment in the most important fight of the story arc. This ha the same benefits for the DM as the story-based approach, but it really needs players to be on-board with it, as it will seriously irritate many players otherwise. This can actually be really fun though if you've got a party who's really into the RP aspect and are running an action-heavy campaign, especially if every battle looks like it's going to be difficult.
You can also mix this in with XP-based leveling, simply giving out exactly enough XP for the next level on occasion when something big happens (in a lot of campaigns I run, there's a situation whereby the party gets to a point they just can't progress unless they take some time to actively train, and I always handle that as a time-skip from player perspective, awarding everybody one or two levels and having them RP the reunion of the party with everybody talking about what their character did as training).
In your particular case, given that you're a new GM, I'd suggest taking the time to read both the PHB and the DMG cover-to-cover, ideally before your next session. That should cover everything as far as the standard leveling methods (I'd suggest going with the first method I mentioned in the XP section if you're doing a pre-constructed adventure module, or the second in the XP section if you're doing a homebrew adventure), as well as hopefully resolving any other things you might not yet have a good understanding of.
Note also that in a lot of cases, most DM's explicitly require the characters to be able to take at least a short rest to level up, and many will require a long rest. This is often touted as being for narrative reasons, but it's important to keep the party balanced as most mages won't be able to use any of their new abilities stuff until they've had a long rest, while most non-magic classes will have all of it immediately available to use even without the rest.