From the PySpark docs rangeBetween:
rangeBetween(start, end)Defines the frame boundaries, from start (inclusive) to end (inc
RANGEbetween looks at the ORDER BY clause to determine if a row is included in a window.
ROWSbetween looks at the order of the rows.
RANGE between checks if the ORDER BY is within some specified range, and will include them in a window.
ROWSbetween will form your window based on what rows are positionally around your current row (irregardless of the value of the ORDER BY column for those rows)