Can a slash in the url be taken as a query insntead of a path to a file directory

By my limited understanding the ” / ” in an URL defines a path in the file directory the html is suppost to be pulled from.

So how is it possible that sites like reddit have URLs such as “reddit.com/u/username”, where the slash doesn’t define the file directory but is more so taken as a query that requests certain data from a user? Shouldn’t you get an error back, that the site doesn’t exist because it’s not actually a file in the directory?