A year is a period of time, so you need it to be between 1st January 00:00:00 and 31st December 23:59:59 when you are querying.
To create the first date, assuming your year is stored as 4 digits such as 2025, you can use the following in a create variable action for a date. This will be the 1st of January for that year.
dateTime($year)
To create the second date, you can use the endOfYear function in a create variable action for date. This will be 31st December of that year.
endOfYear(dateTime($year))
https://docs.mendix.com/refguide/end-of-date-function-calls/#endOfYear
Now when you search, you need to look between the start of year and the end of year.
[createDate >= $startofyear and createDate =< $endofyear]
I hope this makes sense and has helped. Good luck