To clear up some confusion:
CE marking is put on certain types of products by the manufacturer. It declares that the product met EU requirements at the time it was put on the market. CE marking is only used on those products where some EU regulation or directives requires it. It is forbidden to use the CE mark on products that are not covered by regulation that requires it. Most electrical equipment will need it in the EU (due to low voltage, EMC or machinery directives, for example), but some will not (for example, electronics exclusively intended for installation on aircraft - different rules). EU regulations and directives have a 'scope' section to declare what is covered and what isn't.
In some cases, the manufacturer must involve external assistance for the conformity checking, the so-called notified bodies. Even then, the main responsibility for safety remains with the manufacturer. The legal definition of manufacturer is not necessarily the company which physically manufactures the device.
EU regulations/directives will specify requirements. Specifically, essential safety requirements (ESR). Sometimes those are pretty vague. For many products, there are harmonised standards. If your product is within the scope of such a standard, and you follow the standard, then you can 'presume conformity' for those ESR items that are listed in the annex ZA of the harmonised standard. In theory, use of such standards is optional. In practice, you need to prove 'equivalent safety' if you decide not to use one, which means you need to take the standard into account anyway. And the notified body might strongly dislike your approach because just following the standard test setups and filling the regular checkboxes is much more convenient for them than certifying a unique method none of their other customers uses. The EU maintains a list of which standards are harmonised for various kinds of devices:
https://single-market-economy.ec.europa.eu/single-market/goods/european-standards/harmonised-standards_enIf there are no harmonised standards... Good luck! It may be an option to use other standards, best current practices (if documented), extensive in-house risk analysis,...
Standards do get expensive. Prices per standard are normally quite manageable, but standards organisations have this tendency to take a document that should logically be one standard, and then split it up into 5 to 20 separate standards, none of which makes sense separately until you buy all parts and read them together. Still, the cost of the standards you need will probably be much lower than the other costs of the project. You might be buying some unnecessary ones too, because you'll only figure out they don't apply to your situation after you have them.
Many of those regulations do not directly or explicitly regulate software (some do). For example, if you have a certain safety requirement for a machine, it must be satisfied. The rules usually do not care if you satisfy the requirement using a hardware solution or a software solution, only that it is satisfied. That must obviously be evaluated for each individual case.