You can upgrade from windows 98 to XP and not lose your files, just chose upgrade from the install menu.
Getting back to windows 98, without losing your files...... thats a bit tricky, it might just be better to "Dual Boot" 98 and XP, so you can use whichever one you want.
You will need to get a program like Partition Magic in order to make 2 partitions without losing data, basically you are going to resize you normal partition and make it maybe 3 or more gigs smaller, then create a new FAT32 partition and have it save the changes.
When you install XP, do a NEW INSTALL, and tell it to install to the second partition. When it finishes you should get a screen for a few seconds asking you which operating system you want to load. This will come up every time you boot.
Enjoy XP, it is a BIG improvement on 98.