Does sleep really affect weight lost

I work pretty late and don’t get home until maybe 10 or 11 .. I’m not a person that can just fall asleep right away so I usually don’t go to sleep until 1 or 2. I’ve heard that if your not sleeping long enough or if you don’t go to sleep early enough it messes up with you trying to lose weight.. my question is if you really don’t get enough sleep could that mess up with my weight loss goals?