The influence of various kinds of structure and phase inhomogeneity on electrical properties of YBCO thin films prepared by inverted cylindrical magnetron sputtering has been investigated. A simultaneous analysis of the changes in the microstructure and electrical parameters has allowed us to define the contribution of each kind of inhomogeneity in the restriction of the film's electrical parameters. It has been found that the transition temperature depends mainly on deviations of the c-axis lattice parameter from its optimum value, the critical current density depends mainly on the out of plane misorientation of the film domains and the microwave surface resistance depends mainly on the volume of the high-angle misoriented domains. By using atomic force and scanning tunnelling microscopy regions of YBCO films with modified properties around Cu-rich second phase particles were observed. It is suggested that superconducting properties of these regions are worse than the matrix due to Cu depletion. Usually the relative area of these inhomogeneities in our films is about 30% and can occupy up to 50% and, therefore, mostly determines the electrical properties of films. It is suggested that the processes of cation disorder deforming the film lattice play an important role in formation of structure and phase inhomogeneities in YBCO thin films.