While in China both variations are commonly used, in English-speaking countries people are mostly familiar with the second way of writing, in the context of the martial art traditions.
"Shifu" is in fact the English spelling of two similar but distinct Chinese words (师傅; shīfù and 师父; shīfu).
Alternatively, it is used as a respectful form of address for skilled tradespeople, such as pharmacists, and workers in various trades like construction, plumbing, carpentry, welding, and electrical work, as well as technicians in fields like telecommunications and mechanics.
It has an association with religion, because Buddhist monks, Confucian scholars and Taoist priests often establish master/apprentice-like relationships with initiates and are addressed with this term.
[1] Although a martial arts shifu may establish a Master-Apprentice type of relationship with certain students, the Chinese characters used for the term do not imply 'Mastery'.
Likewise, whether or not fellow disciples are addressed as "big" or "little" brother/sister depended on whether they were adopted by the master before or after the subject, not on whether or not they are actually older or younger in age.
[5] After the ceremony, the relationship is defined in a more direct parent–child context and usage takes on this term rather than a generic sign of respect for skill and knowledge.