Toothpaste is a paste or gel dentifrice used with a toothbrush to clean and maintain the aesthetics and health of teeth. Toothpaste is used to promote oral hygiene.
Seeing that you rinsed your mouth, and you spat out the water, that would be sufficient, and your fasting is valid, even though your tastebuds still feel the taste of toothpaste. Of course, this is as long as there is no remaining traces of the toothpaste itself, and you swallow the natural saliva in your mouth.
And Allah knows best.
If dental products contain alcohol, then they become najis. If you can use it without swallowing it, then it could be permissible to use for its purpose; but if you feel that it is impossible not to swallow some of it, then it is haram for you to use it.