If the user in question has not provided a username, it may be impossible to ban them. However, if they have sent a message, you can forward it to @userinfobot to get their user id. With this information, you can then ban the user based on their user id. It is possible that the user may not be a member, so it is worth checking before attempting to ban them. Unfortunately, if you have already blocked the user, it may be too late to check.