This solution is for line.
First of all I made 2 polygon feature classes and one line.
Then I used Near and made inputs as shown below.
When you have distance from green polygon (poly2) to all others you can make Select by Location to select only polygons intersecting the line. Then just export selection and you will have only those which are on the line plus you will be able to sort them by distance from polygon which is near the beginning of the line.
Below you got sample code for this remember to change: gdb location, in_features, near_features, line_fc and output_name to your preferences.
arcpy.env.overwriteOutput = True
arcpy.env.workspace = r"**GDB LOCATION**"
in_features = 'poly'
near_features = 'poly2'
line_fc = 'line'
output_name = "poly_Intersect"
arcpy.SelectLayerByLocation_management('poly_lyr', 'intersect', line_fc)
arcpy.CopyFeatures_management('poly_lyr', output_name )