Start here. This is the direct spoken answer to practice first.
Why this question matters
Dynamic filtering is common in admin pages and search APIs. It becomes risky when optional filters force client-side work or produce SQL that cannot use indexes.
I would keep the query as an IQueryable while composing optional filters, sorting, and pagination. Each filter needs to be translatable to SQL. I would avoid calling ToList, AsEnumerable, or custom C# methods before all database-side filters are applied. Once the query is fully shaped, I would materialize it with ToListAsync or another async terminal operation.