Enemies moving back and fourth in a cycle.

I would like help on making the enemies in my game harder to get or either way more dangerous, therefore I would like help on moving enemies, suggestions on ways to make them harder to get to or either multiple solutions as if possible.

You could use a collision with a non-solid invisible block that would turn the character
Or you could use the raycast to detect if there is ground in front of the character or not