Searching Users First name and Last name

Hey so i was wondering i created a ActivedirectoryTool where i can disable users etc. but i need to search for there User logon pre windows 2000 and i dont want that, i want to search for there First name or Last name so its easier for other users to search. I have created an API Endpoint that gets called from the apps page like this:

Is there any way that i could change this code and make it so that i can search with Frist and Last name?

You should be able to use filters to use other properties in your user lookup.

Get-ADUser -Filter "GivenName -like '$UserName*' -or Surname -like '$UserName*'"