It’s certainly no bad habit to handle spaces in scripts preemptively, and obviously they do occur in the wild. Quotes from ls output do not get piped to other commands. I had to look that up myself right now, because it has been quite a while since it mattered to me.
<span style="color:#323232;">$ touch 'file with spaces in name'
</span><span style="color:#323232;">$ ls
</span><span style="color:#323232;">'file with spaces in name'
</span><span style="color:#323232;">$ ls | cat
</span><span style="color:#323232;">file with spaces in name
</span><span style="color:#323232;">$
</span>
Looking through some scripts I wrote back in the day, I seem to like to use ls -1 in scripts. I guess that reduces ambiguity on what the separator is.