Need help on rendering order

my game is canvas based and only uses UI, but something makes couple of objects go to -19000 in Z axis and after that it doesn’t render most other objects. Cone has 2 places where vector3 is mentioned. Mostly uses vector2.moveTowards… Is there a way to make custom renderer or fix the bug?

I think I found solution, but I would need some simplified explanation why this fixes it:

as shown I just added canvas component and ordered my way and it works!