You could definitely do this natively. If going that route, I would employ the Postgres COPY function along with a temp table in your query, discarding the temp table when finished. If I'm not mistaken, this would require that your file be present inside of a folder that Postgres has control over, such as your data folder, wherever you have Postgres installed.
However, for a cleaner look, I would prefer employing PL/R for something like this. You can quickly read from the file and return an array of values to use in your query. I'm sure you can substitute PL/R with PL/PYTHON or whatever else you prefer that has methods for accessing external files.
CREATE FUNCTION file_vals()
RETURNS integer[] AS
$BODY$
return (readLines('C:/path/to/your/file.txt'))
$BODY$
LANGUAGE plr IMMUTABLE;
Your file.txt looks like:
555
123
567
Then call from your function (I put sample data in a subquery to simplify):
WITH users AS(
SELECT 123 AS userID
)
SELECT userID
FROM users
WHERE userID = ANY(file_vals())
Edit: As DanielVérité pointed out in the comments, it's important to note that this only works if you have admin privileges over your database. PL/R and any other language extension that gives you external file access will inherently be an untrusted language, which means only admins can create functions in those languages.
It's also important to note that the file you're reading from must be accessible directly from the Postgres server. If you're executing these queries via remote client, you'll need to get that file over to the server first.