Type::method is a method reference. In the case of User::getFirstName, this is already of the type User -> String.
Functions in Java are not first class citizens. There are no operators for composing them or concatenating them. The + operator for example is not defined for User -> String (+) User -> String. It is defined for String + String, though.
So what you want is not to write bare method references, but to create an expression that is overall of the type User -> String, but utilizes the + operator for actual strings.
A lambda accepting a User needs that as first parameter, and it needs to return a string. u -> "Hello, World" would be such a lambda. Putting it together as needed, you end up with:
Function<User, String> userToFullName = u -> u.getFirstName() + "|" + u.getLastName();
You can then use that function inside your collector:
Function<User, String> userToFullName = user -> user.getFirstName() + "|" + user.getLastName();
Map<String,Long> userIdMap =
users.stream()
.collect(Collectors.toMap(userToFullName, User::getId));
Or, if you do not want to store the lambda explicitly in a named variable:
Map<String,Long> userIdMap =
users.stream()
.collect(
Collectors.toMap(
user -> user.getFirstName() + "|" + user.getLastName(),
User::getId
));