もう少しで + [verb (dictionary form)] + ところだった もう少しで + [verb (dictionary form)] もう少しで + [noun] + だ
もう少しで means "almost", "nearly" – literally "with a little more". With ところだった after a verb in the dictionary form, it says something nearly happened and then didn't.
The verb before ところだった stays in the dictionary form even though the sentence is about the past. のりおくれた乗り遅れたところだった would mean "I had just missed it".
With a non-past verb or a noun, もう少しで says the end is close and is expected to come.
In conversation もうちょっとで means the same and sounds more casual.