tl;dr
If you want to just insert a hyphen between graphemes, this works.
\documentclass{article}
\usepackage{iftex}
\iftutex
\usepackage{fontsetup}
\fi
\ExplSyntaxOn
\NewDocumentCommand{\unicodespell}{m}
{
\seq_clear:N \l_tmpa_seq
\text_map_inline:nn { #1 } { \seq_put_right:Nn \l_tmpa_seq { ##1 } }
\seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl
\tl_use:N \l_tmpa_tl
\seq_map_inline:Nn \l_tmpa_seq { -##1 }
}
\ExplSyntaxOff
\begin{document}
\iftutex
\unicodespell{éxãm̃ple}% can't work correctly in pdflatex
\else
\unicodespell{éxãmple}% but this works in pdflatex
\fi
\end{document}
Output with pdflatex

Note. The word éxãmple
is used here (pdflatex
is not able to cope with combining characters).
Output with xelatex
or lualatex

Note. Here you see that even m̃
, that is, the combination U+006D LATIN SMALL LETTER M with U+0303 COMBINING TILDE, is treated correctly.
Comparison with wipet's solution, that claims to work with Unicode. Compile with optex
.
\fontfam[Termes]
\def\spell #1{\spellA#1{}}
\def\spellA #1{\spellFirst{#1}\spellB}
\def\spellB #1{\ifx^#1^\else\spellNext{#1}\expandafter\spellB\fi}
% format is given by:
\def\spellFirst #1{#1} % only copy to the output
\def\spellNext #1{-#1} % add `-` before the character
\spell{éxãm̃ple}% this doesn't work
\bye

Original answer with more details
Inserting some tokens between each item is easy: detach the first item in the given string and then process the rest by adding the second argument in front of each item.
At the end, optionally add the second argument. If you want to swap the behavior of the *
-variant, just change \IfBooleanT
into \IfBooleanF
.
The examples below show that this works also with one-letter words or even with empty first argument.
\documentclass{article}
\ExplSyntaxOn
\NewDocumentCommand{\spell}{smm}
{
\tl_head:n { #2 }
\tl_map_inline:en { \tl_tail:n { #2 } } { #3 ##1 }
\IfBooleanF{#1}{#3}
}
\cs_generate_variant:Nn \tl_map_inline:nn { e }
\ExplSyntaxOff
\begin{document}
\spell*{example}{-}
\spell{example}{-}
\spell*{example}{=}
\spell*{e}{-} \spell{e}{-}
X\spell{}{-}X
\end{document}

If however you want to have more general formatting of the items, say \fbox
ing each of them, you need to do something more.
\documentclass{article}
\ExplSyntaxOn
\NewDocumentCommand{\spell}{smm}
{
\chzzh_spell:nnn { #1 } { #2 } { #3 }
}
\cs_generate_variant:Nn \tl_map_function:nN { e }
\cs_new_protected:Nn \chzzh_spell:nnn
{
\cs_set_protected:Nn \__chzzh_spell_item:n { #3 }
\tl_map_function:eN { \tl_range:nnn { #2 } { 1 } { -2 } } \__chzzh_spell_item:n
\bool_if:nTF { #1 }
{
\tl_item:nn { #2 } { -1 }
}
{
\__chzzh_spell_item:e { \tl_item:nn { #2 } { -1 } }
}
}
\cs_new_protected:Nn \__chzzh_spell_item:n {} % initialize
\cs_generate_variant:Nn \__chzzh_spell_item:n { e }
\ExplSyntaxOff
\begin{document}
\spell{example}{#1-}
\spell*{example}{#1-}
\spell{example}{\fbox{#1}}
\end{document}
Here the detached item is the last one.

However, if your text is expected to have non ASCII characters, you need something more; with the help of \text_map_inline:nn
we can populate a sequence and act on it.
\documentclass{article}
\ExplSyntaxOn
\NewDocumentCommand{\spell}{smm}
{
\chzzh_spell:nnn { #1 } { #2 } { #3 }
}
\cs_generate_variant:Nn \tl_map_function:nN { e }
\seq_new:N \l__chzzh_spell_seq
\tl_new:N \l__chzzh_spell_last_tl
\cs_new_protected:Nn \chzzh_spell:nnn
{
% populate the sequence with the items in #2
\seq_clear:N \l__chzzh_spell_seq
\text_map_inline:nn { #2 }
{
\seq_put_right:Nn \l__chzzh_spell_seq { ##1 }
}
% detach the last item
\seq_pop_right:NN \l__chzzh_spell_seq \l__chzzh_spell_last_tl
% define the aux function like specified by the last argument
\cs_set_protected:Nn \__chzzh_spell_item:n { #3 }
% map the sequence
\seq_map_function:NN \l__chzzh_spell_seq \__chzzh_spell_item:n
% deal with the last item
\bool_if:nTF { #1 }
{
\tl_use:N \l__chzzh_spell_last_tl
}
{
\__chzzh_spell_item:V \l__chzzh_spell_last_tl
}
}
\cs_new_protected:Nn \__chzzh_spell_item:n {} % initialize
\cs_generate_variant:Nn \__chzzh_spell_item:n { V }
\ExplSyntaxOff
\begin{document}
\spell{example}{#1-}
\spell*{example}{#1-}
\spell{éxãmple}{\fbox{#1}}
\end{document}
