Visual UI or functional testing, which one should I use and when?

I have been confused between visual UI or functional testing, Can antbody please provide me some suggestions regarding whch one shoud use.