My understanding is that katakana is used for situations where it’s the sound that is important, not necessarily the meaning. So it’s used for loan words, but also for onomatopoeia, and when writing your name down on a waitlist at a restaurant. (Often it is not clear how to pronounce a name from how it is written)