This is a problem that is not and will not be completely solved.
In general, you sort by the reading of a word, in the gojūon order, regardless of the actual character. If you had a list of nonsense words like [あかさ, アカコ, 赤{あか}け], they would be sorted to an ascending order like this:
This is not part of gojūon, but computers sort characters so that dakuten (like in ば) and handakuten (like in ぱ) come after は: sorted([ば、ぱ、は])
→ [は、ば、ぱ]
. Small kana come before normal-sized kana: sorted([づ、っ、つ])
→ [っ、つ、づ]
.
You will have to decide yourself what to do with words that have the same reading but are in ひらがな, カタカナ or 漢字. One way is to not care and just treat them equally, but you can also keep the list organized and choose to sort hiragana before katakana and katakana before kanji. If there are many words with the same reading but different kanji, you can use the code point of the kanji as a fallback (more about that later).
However, as @Jimmy said in comments, names (and even some words written in kanji) can have multiple readings. You will not know how to sort for example the name 淳子, because it can be read じゅんこ、あつこ、きよこ、あきこ. Also the word 日日 can be read ひび、ひにち or even にちにち.
Then there are marks that depend on the previous syllable.
- Long vowel mark 「ー」 should be read as ア in シャワー.
- Iteration marks (ゝ、ゞ、ヽ、ヾ) indicate repeated kana, possibly voicing it in the process. They are not commonly used and it might not be worth the trouble to convert them to kana for sorting.
Kanji repetition marks (々) might need to be converted to the preceding kanji if the dictionary used for reading lookup doesn't index words that frequently use them. Example: 日々 → 日日.
If we're talking about computer-based sorting, the program sorting the words or names could check word readings from a dictionary, and in uncertain cases choose the most common alternative. This kind of functionality doesn't exist by default in any programming languages that I know of, and they sort the strings according to the code point of each character. This happens to be alphabetical in English, but as you can see, if the string is not converted to upper- or lowercase completely, uppercase will always come before lowercase.
Here is a corresponding list for hiragana and here for katakana. Because hiragana starts at 0x3040
and katakana starts at 0x30A0
, hiragana will be sorted before katakana like UPPERCASE vs. lowercase by default. The code page is mostly in gojūon order (excluding rare kana like ヴ/ゖ), and one way of sorting would be to convert every word to katakana or hiragana and sort by that.