You can have an AI task similar to this:
Analyze the user input and detect if he included the unit of measure. If the unit of measure is kilometers or any of its abbreviations output kilometer. If the unit of measure is miles or any its abbreviations output miles. If the unit is not specified in the answer, output none.
Then you store this output in a variable and you do a simple expression, if workflow.unit == "mile" || workflow.unit =="kilometer" you continue your flow, else you create another node where you ask the user to specify the unit