ToObjectSpace returns the offset of Part2.CFrame relative to Part1.CFrame
ToWorldSpace is basically just cframe multiplication, aka (CFrame * CFrame)
it first get’s the Part2 cframe relative to 0,0,0 position and rotation and applies that object space to Part1’s cframe
I recommend you read the cframe math operations article to get a more in depth knowledge on cframe math