Ok, first off, I'll go with whatever someone else had said about storing all the tiles to a data structure, like an array. Studio 2 has good tile handling functions, but still, the less often you call a tile function, the better. Reading an aray is going to be faster than looking up tiles. With that said.... Considering how new you are, I'll just stick with tile collisions.
Second, I might have gotten you confused with this guy, who was also doing a Pac-Man style game:
https://forum.yoyogames.com/index.php?threads/random-enemy-movement-for-a-maze-game.66768/
You can see a DnD code I drafted up for him. Not sure how accurate it was, because he never replied. lol Still, the principle is there for the ghosts.
You can still use DnD to handle tile collisions. You use the action
Get Tile Data At Pixel
You'd want to set the x AND y values to be
relative and you'd just use your tiles' height or width as the offset for whatever direction you're looking. I think it's stupid you have to mark x and y both as relative separately, but whatever -- hooray for flexibility! Also, this function saves the result to a variable. You may as well make it a temp variable, since it's probably useless outside this code.
Anyway, let's assume your tiles are 64x64. If you want to check for a tile moving right, you'd put 64 in the x. If you want to check for a tile moving left, you'd put -64. To look up, put -64 in y. To move down, put 64 in y. Pretty simple.
The GML equivalent is tilemap_get_at_pixel(). More on the function here:
https://docs2.yoyogames.com/
I don't have GMS2 anymore, so that's about the extent of my help there. lol I never messed with tiles enough when I had it...