I would just be easier to create a temporary field
Python.. parser in the field calculator going into a text field
!FirstField![:5] + !SecondField![:5]
then query that field and do what you need with the results.
Or build a query using a logical and
File geodatabases support limited string functions: SQL reference for query expressions used in ArcGIS—ArcGIS Pro | ArcGIS Desktop . Using Select By Attribute tool,
SUBSTRING(Field1 FROM 1 FOR 5) <> SUBSTRING(Field2 FROM 1 FOR 5)